From db5af0d7115781be12f510322ee01556fb1e6d16 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Fri, 20 May 2016 20:58:44 +0000 Subject: [PATCH] net/http: update bundled http2 Updates x/net/http2 to git rev 4d07e8a49 for CL 23287: http2: let handlers close Request.Body without killing streams https://golang.org/cl/23287 Fixes #15425 Change-Id: I20b6e37cd09aa1d5a040c122ca0daf14b8916559 Reviewed-on: https://go-review.googlesource.com/23301 Run-TryBot: Brad Fitzpatrick Reviewed-by: Brad Fitzpatrick --- src/net/http/h2_bundle.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go index 55111523e5..563e2c0c9b 100644 --- a/src/net/http/h2_bundle.go +++ b/src/net/http/h2_bundle.go @@ -4351,7 +4351,7 @@ type http2requestBody struct { func (b *http2requestBody) Close() error { if b.pipe != nil { - b.pipe.CloseWithError(http2errClosedBody) + b.pipe.BreakWithError(http2errClosedBody) } b.closed = true return nil @@ -4976,12 +4976,14 @@ func (cs *http2clientStream) awaitRequestCancel(req *Request) { } } -// checkReset reports any error sent in a RST_STREAM frame by the -// server. -func (cs *http2clientStream) checkReset() error { +// checkResetOrDone reports any error sent in a RST_STREAM frame by the +// server, or errStreamClosed if the stream is complete. +func (cs *http2clientStream) checkResetOrDone() error { select { case <-cs.peerReset: return cs.resetErr + case <-cs.done: + return http2errStreamClosed default: return nil } @@ -5641,7 +5643,7 @@ func (cs *http2clientStream) awaitFlowControl(maxBytes int) (taken int32, err er if cs.stopReqBody != nil { return 0, cs.stopReqBody } - if err := cs.checkReset(); err != nil { + if err := cs.checkResetOrDone(); err != nil { return 0, err } if a := cs.flow.available(); a > 0 { @@ -5810,6 +5812,7 @@ func (cc *http2ClientConn) streamByID(id uint32, andRemove bool) *http2clientStr cc.lastActive = time.Now() delete(cc.streams, id) close(cs.done) + cc.cond.Broadcast() } return cs } -- 2.52.0