aboutsummaryrefslogtreecommitdiff
path: root/http.go
diff options
context:
space:
mode:
authorGravatar byene0923 <34917110+byene0923@users.noreply.github.com> 2022-10-30 00:32:08 +0800
committerGravatar GitHub <noreply@github.com> 2022-10-29 18:32:08 +0200
commite2141372b6f9007fe964cf8355852e8843fbbf2c (patch)
tree8e6f99a10e0d64db05d88695ef8af0030a14df9c /http.go
parentoptimize: adjust the behavior of PeekAll based on VisitAll (#1403) (diff)
downloadfasthttp-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.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/http.go b/http.go
index 97bf5d6..62ba30f 100644
--- a/http.go
+++ b/http.go
@@ -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
}