diff options
author | byene0923 <34917110+byene0923@users.noreply.github.com> | 2022-10-30 00:32:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-29 18:32:08 +0200 |
commit | e2141372b6f9007fe964cf8355852e8843fbbf2c (patch) | |
tree | 8e6f99a10e0d64db05d88695ef8af0030a14df9c /http.go | |
parent | optimize: adjust the behavior of PeekAll based on VisitAll (#1403) (diff) | |
download | fasthttp-e2141372b6f9007fe964cf8355852e8843fbbf2c.tar.gz fasthttp-e2141372b6f9007fe964cf8355852e8843fbbf2c.tar.bz2 fasthttp-e2141372b6f9007fe964cf8355852e8843fbbf2c.zip |
fix: ignore body should not set content-length of streaming (#1406)
* fix: ignore body should not set content-length of streaming https://github.com/valyala/fasthttp/pull/1022
* fix: add commit
Diffstat (limited to 'http.go')
-rw-r--r-- | http.go | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1287,7 +1287,11 @@ func (req *Request) ContinueReadBodyStream(r *bufio.Reader, maxBodySize int, pre // the end of body is determined by connection close. // So just ignore request body for requests without // 'Content-Length' and 'Transfer-Encoding' headers. - req.Header.SetContentLength(0) + + // refer to https://tools.ietf.org/html/rfc7230#section-3.3.2 + if !req.Header.ignoreBody() { + req.Header.SetContentLength(0) + } return nil } |