From: Brad Fitzpatrick Date: Wed, 13 Jan 2016 17:53:57 +0000 (+0000) Subject: net/http: update bundled http2 X-Git-Tag: go1.6beta2~12 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=4206e9d343e07f3b2f6c0fe7d5d93c30024eaa96;p=gostls13.git net/http: update bundled http2 Updates x/net/http2 to git rev c93a9b4f2a for https://golang.org/cl/18474 Forgot to submit this four days ago. Change-Id: Id96ab164ec765911c31874cca39b44aa55e80153 Reviewed-on: https://go-review.googlesource.com/18574 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick --- diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go index 5f08857564..34b94798ab 100644 --- a/src/net/http/h2_bundle.go +++ b/src/net/http/h2_bundle.go @@ -24,7 +24,6 @@ import ( "encoding/binary" "errors" "fmt" - "golang.org/x/net/http2/hpack" "io" "io/ioutil" "log" @@ -38,6 +37,8 @@ import ( "strings" "sync" "time" + + "golang.org/x/net/http2/hpack" ) // ClientConnPool manages a pool of HTTP/2 client connections. @@ -705,6 +706,8 @@ type http2Framer struct { // other HTTP/2 implementations' conformance to the spec. AllowIllegalReads bool + logReads bool + debugFramer *http2Framer // only use for logging written writes debugFramerBuf *bytes.Buffer } @@ -748,6 +751,7 @@ func (f *http2Framer) logWrite() { if f.debugFramer == nil { f.debugFramerBuf = new(bytes.Buffer) f.debugFramer = http2NewFramer(nil, f.debugFramerBuf) + f.debugFramer.logReads = false f.debugFramer.AllowIllegalReads = true } @@ -778,8 +782,9 @@ const ( // NewFramer returns a Framer that writes frames to w and reads them from r. func http2NewFramer(w io.Writer, r io.Reader) *http2Framer { fr := &http2Framer{ - w: w, - r: r, + w: w, + r: r, + logReads: http2logFrameReads, } fr.getReadBuf = func(size uint32) []byte { if cap(fr.readBuf) >= int(size) { @@ -848,6 +853,9 @@ func (fr *http2Framer) ReadFrame() (http2Frame, error) { if err := fr.checkFrameOrder(f); err != nil { return nil, err } + if fr.logReads { + log.Printf("http2: Framer %p: read %v", fr, http2summarizeFrame(f)) + } return f, nil } @@ -1857,6 +1865,7 @@ func http2lowerHeader(v string) string { var ( http2VerboseLogs bool http2logFrameWrites bool + http2logFrameReads bool ) func init() { @@ -1867,6 +1876,7 @@ func init() { if strings.Contains(e, "http2debug=2") { http2VerboseLogs = true http2logFrameWrites = true + http2logFrameReads = true } }