Commit 8d75558b authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

net/http: update bundled http2

Updates http2 to x/net/http2 git rev 973f3f3 for:

   http2: make Transport treat http.NoBody like it were nil
   https://golang.org/cl/45993

Updates #18891

Change-Id: I846ccf286992ed2c6249014e51fdeb40b35e50ed
Reviewed-on: https://go-review.googlesource.com/46000
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent ec7c6c16
...@@ -2996,6 +2996,8 @@ func http2reqBodyIsNoBody(body io.ReadCloser) bool { ...@@ -2996,6 +2996,8 @@ func http2reqBodyIsNoBody(body io.ReadCloser) bool {
return body == NoBody return body == NoBody
} }
func http2go18httpNoBody() io.ReadCloser { return NoBody } // for tests only
func http2configureServer19(s *Server, conf *http2Server) error { func http2configureServer19(s *Server, conf *http2Server) error {
s.RegisterOnShutdown(conf.state.startGracefulShutdown) s.RegisterOnShutdown(conf.state.startGracefulShutdown)
return nil return nil
...@@ -7196,7 +7198,7 @@ func http2checkConnHeaders(req *Request) error { ...@@ -7196,7 +7198,7 @@ func http2checkConnHeaders(req *Request) error {
// req.ContentLength, where 0 actually means zero (not unknown) and -1 // req.ContentLength, where 0 actually means zero (not unknown) and -1
// means unknown. // means unknown.
func http2actualContentLength(req *Request) int64 { func http2actualContentLength(req *Request) int64 {
if req.Body == nil { if req.Body == nil || http2reqBodyIsNoBody(req.Body) {
return 0 return 0
} }
if req.ContentLength != 0 { if req.ContentLength != 0 {
...@@ -7227,8 +7229,8 @@ func (cc *http2ClientConn) RoundTrip(req *Request) (*Response, error) { ...@@ -7227,8 +7229,8 @@ func (cc *http2ClientConn) RoundTrip(req *Request) (*Response, error) {
} }
body := req.Body body := req.Body
hasBody := body != nil
contentLen := http2actualContentLength(req) contentLen := http2actualContentLength(req)
hasBody := contentLen != 0
// TODO(bradfitz): this is a copy of the logic in net/http. Unify somewhere? // TODO(bradfitz): this is a copy of the logic in net/http. Unify somewhere?
var requestedGzip bool var requestedGzip bool
......
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