]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: update bundled http2
authorBrad Fitzpatrick <bradfitz@golang.org>
Fri, 20 May 2016 20:58:44 +0000 (20:58 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 20 May 2016 21:20:00 +0000 (21:20 +0000)
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 <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/http/h2_bundle.go

index 55111523e587f5f57b6a6777c0fdd54273fc61b5..563e2c0c9b7d6c82197e0609c13f4f1066810fa4 100644 (file)
@@ -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
 }