diff options
| author | Brad Fitzpatrick <bradfitz@golang.org> | 2016-05-21 00:25:48 +0000 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2016-05-21 01:29:57 +0000 |
| commit | def50f8e488dcfb12362d4b84feb38de3af5cadc (patch) | |
| tree | 6c2a0ef7af15b2cf0391e78dfc2536e65c8e5050 /src | |
| parent | 82ec4cd79f117191d12fc14060c4b4b786feca5b (diff) | |
| download | go-def50f8e488dcfb12362d4b84feb38de3af5cadc.tar.xz | |
net/http: update bundled http2
Updates x/net/http2 to git rev 0c607074 for https://golang.org/cl/23311,
"http2: prevent Server from sending status 100 header after anything else"
New test is in the x/net/http2 package (not bundled to std).
Fixes #14030
Change-Id: Ifc6afa4a5fe35977135428f6d0e9f7c164767720
Reviewed-on: https://go-review.googlesource.com/23312
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/net/http/h2_bundle.go | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go index 563e2c0c9b..9cedcaa73d 100644 --- a/src/net/http/h2_bundle.go +++ b/src/net/http/h2_bundle.go @@ -3111,6 +3111,7 @@ type http2stream struct { sentReset bool // only true once detached from streams map gotReset bool // only true once detacted from streams map gotTrailerHeader bool // HEADER frame for trailers was seen + wroteHeaders bool // whether we wrote headers (not status 100) reqBuf []byte trailer Header // accumulated trailers @@ -3474,7 +3475,21 @@ func (sc *http2serverConn) writeFrameFromHandler(wm http2frameWriteMsg) error { // If you're not on the serve goroutine, use writeFrameFromHandler instead. func (sc *http2serverConn) writeFrame(wm http2frameWriteMsg) { sc.serveG.check() - sc.writeSched.add(wm) + + var ignoreWrite bool + + switch wm.write.(type) { + case *http2writeResHeaders: + wm.stream.wroteHeaders = true + case http2write100ContinueHeadersFrame: + if wm.stream.wroteHeaders { + ignoreWrite = true + } + } + + if !ignoreWrite { + sc.writeSched.add(wm) + } sc.scheduleFrameWrite() } |
