Commit 0d8126fc authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

http2: don't sniff Request.Body on 100-continue requests in Transport

Tests in net/http: TestNoSniffExpectRequestBody_h2

Updates golang/go#16002

Change-Id: Ib5255c14f0a8fdafd36077b86442dff213815567
Reviewed-on: https://go-review.googlesource.com/30150
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 69729301
......@@ -643,6 +643,11 @@ func bodyAndLength(req *http.Request) (body io.Reader, contentLen int64) {
if req.ContentLength != 0 {
return req.Body, req.ContentLength
}
// Don't try to sniff the size if they're doing an expect
// request (Issue 16002):
if req.Header.Get("Expect") == "100-continue" {
return req.Body, -1
}
// We have a body but a zero content length. Test to see if
// it's actually zero or just unset.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment