Commit 4206e9d3 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

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/18574Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
parent e405c29c
...@@ -24,7 +24,6 @@ import ( ...@@ -24,7 +24,6 @@ import (
"encoding/binary" "encoding/binary"
"errors" "errors"
"fmt" "fmt"
"golang.org/x/net/http2/hpack"
"io" "io"
"io/ioutil" "io/ioutil"
"log" "log"
...@@ -38,6 +37,8 @@ import ( ...@@ -38,6 +37,8 @@ import (
"strings" "strings"
"sync" "sync"
"time" "time"
"golang.org/x/net/http2/hpack"
) )
// ClientConnPool manages a pool of HTTP/2 client connections. // ClientConnPool manages a pool of HTTP/2 client connections.
...@@ -705,6 +706,8 @@ type http2Framer struct { ...@@ -705,6 +706,8 @@ type http2Framer struct {
// other HTTP/2 implementations' conformance to the spec. // other HTTP/2 implementations' conformance to the spec.
AllowIllegalReads bool AllowIllegalReads bool
logReads bool
debugFramer *http2Framer // only use for logging written writes debugFramer *http2Framer // only use for logging written writes
debugFramerBuf *bytes.Buffer debugFramerBuf *bytes.Buffer
} }
...@@ -748,6 +751,7 @@ func (f *http2Framer) logWrite() { ...@@ -748,6 +751,7 @@ func (f *http2Framer) logWrite() {
if f.debugFramer == nil { if f.debugFramer == nil {
f.debugFramerBuf = new(bytes.Buffer) f.debugFramerBuf = new(bytes.Buffer)
f.debugFramer = http2NewFramer(nil, f.debugFramerBuf) f.debugFramer = http2NewFramer(nil, f.debugFramerBuf)
f.debugFramer.logReads = false
f.debugFramer.AllowIllegalReads = true f.debugFramer.AllowIllegalReads = true
} }
...@@ -780,6 +784,7 @@ func http2NewFramer(w io.Writer, r io.Reader) *http2Framer { ...@@ -780,6 +784,7 @@ func http2NewFramer(w io.Writer, r io.Reader) *http2Framer {
fr := &http2Framer{ fr := &http2Framer{
w: w, w: w,
r: r, r: r,
logReads: http2logFrameReads,
} }
fr.getReadBuf = func(size uint32) []byte { fr.getReadBuf = func(size uint32) []byte {
if cap(fr.readBuf) >= int(size) { if cap(fr.readBuf) >= int(size) {
...@@ -848,6 +853,9 @@ func (fr *http2Framer) ReadFrame() (http2Frame, error) { ...@@ -848,6 +853,9 @@ func (fr *http2Framer) ReadFrame() (http2Frame, error) {
if err := fr.checkFrameOrder(f); err != nil { if err := fr.checkFrameOrder(f); err != nil {
return nil, err return nil, err
} }
if fr.logReads {
log.Printf("http2: Framer %p: read %v", fr, http2summarizeFrame(f))
}
return f, nil return f, nil
} }
...@@ -1857,6 +1865,7 @@ func http2lowerHeader(v string) string { ...@@ -1857,6 +1865,7 @@ func http2lowerHeader(v string) string {
var ( var (
http2VerboseLogs bool http2VerboseLogs bool
http2logFrameWrites bool http2logFrameWrites bool
http2logFrameReads bool
) )
func init() { func init() {
...@@ -1867,6 +1876,7 @@ func init() { ...@@ -1867,6 +1876,7 @@ func init() {
if strings.Contains(e, "http2debug=2") { if strings.Contains(e, "http2debug=2") {
http2VerboseLogs = true http2VerboseLogs = true
http2logFrameWrites = true http2logFrameWrites = true
http2logFrameReads = true
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment