]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: update bundled http2
authorBrad Fitzpatrick <bradfitz@golang.org>
Wed, 13 Jan 2016 17:53:57 +0000 (17:53 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 13 Jan 2016 18:15:52 +0000 (18:15 +0000)
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 <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

src/net/http/h2_bundle.go

index 5f088575646c93222ced6bf0f543dec7c2629a8c..34b94798abd12265574a5c845a41c84ac700fed7 100644 (file)
@@ -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
        }
 }