]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.15] net/http: update bundled x/net/http2
authorDmitri Shuralyov <dmitshur@golang.org>
Thu, 29 Oct 2020 22:50:31 +0000 (18:50 -0400)
committerDmitri Shuralyov <dmitshur@golang.org>
Fri, 30 Oct 2020 15:57:43 +0000 (15:57 +0000)
Bring in the change in CL 266158 with:

go mod edit -replace=golang.org/x/net=golang.org/x/net@release-branch.go1.15-bundle
GOFLAGS='-mod=mod' go generate -run=bundle std
go mod edit -dropreplace=golang.org/x/net
go get -d golang.org/x/net@release-branch.go1.15
go mod tidy
go mod vendor

Updates #39337.
Fixes #42113.

Change-Id: I3ebef4b90c11ad271b7a3031aafd80c423c2c241
Reviewed-on: https://go-review.googlesource.com/c/go/+/266375
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
src/net/http/h2_bundle.go

index 29296991ef386c68afdbe41643dac91cb1d4bf80..b03b84d2f309571df1f0c2721fc760634ca7aa2d 100644 (file)
@@ -7168,6 +7168,7 @@ func (t *http2Transport) newClientConn(c net.Conn, singleUse bool) (*http2Client
        cc.inflow.add(http2transportDefaultConnFlow + http2initialWindowSize)
        cc.bw.Flush()
        if cc.werr != nil {
+               cc.Close()
                return nil, cc.werr
        }
 
@@ -7533,6 +7534,15 @@ func (cc *http2ClientConn) roundTrip(req *Request) (res *Response, gotErrAfterRe
        bodyWriter := cc.t.getBodyWriterState(cs, body)
        cs.on100 = bodyWriter.on100
 
+       defer func() {
+               cc.wmu.Lock()
+               werr := cc.werr
+               cc.wmu.Unlock()
+               if werr != nil {
+                       cc.Close()
+               }
+       }()
+
        cc.wmu.Lock()
        endStream := !hasBody && !hasTrailers
        werr := cc.writeHeaders(cs.ID, endStream, int(cc.maxFrameSize), hdrs)