author | Brad Fitzpatrick
<bradfitz@golang.org> 2016-08-02 14:09:40 UTC |
committer | Brad Fitzpatrick
<bradfitz@golang.org> 2016-08-02 14:27:26 UTC |
parent | 28d1bd4fbe7e56c9025ffe3a89113fa4f5e48f31 |
http2/frame.go | +9 | -0 |
http2/http2_test.go | +1 | -1 |
diff --git a/http2/frame.go b/http2/frame.go index bd50d09..6769907 100644 --- a/http2/frame.go +++ b/http2/frame.go @@ -1419,6 +1419,9 @@ func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) { hdec.SetEmitEnabled(true) hdec.SetMaxStringLength(fr.maxHeaderStringLen()) hdec.SetEmitFunc(func(hf hpack.HeaderField) { + if VerboseLogs && logFrameReads { + log.Printf("http2: decoded hpack field %+v", hf) + } if !httplex.ValidHeaderFieldValue(hf.Value) { invalid = headerFieldValueError(hf.Value) } @@ -1477,10 +1480,16 @@ func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) { } if invalid != nil { fr.errDetail = invalid + if VerboseLogs { + log.Printf("http2: invalid header: %v", invalid) + } return nil, StreamError{mh.StreamID, ErrCodeProtocol} } if err := mh.checkPseudos(); err != nil { fr.errDetail = err + if VerboseLogs { + log.Printf("http2: invalid pseudo headers: %v", err) + } return nil, StreamError{mh.StreamID, ErrCodeProtocol} } return mh, nil diff --git a/http2/http2_test.go b/http2/http2_test.go index 549ff5e..22c2ace 100644 --- a/http2/http2_test.go +++ b/http2/http2_test.go @@ -28,7 +28,7 @@ func condSkipFailingTest(t *testing.T) { func init() { DebugGoroutines = true - flag.BoolVar(&VerboseLogs, "verboseh2", false, "Verbose HTTP/2 debug logging") + flag.BoolVar(&VerboseLogs, "verboseh2", VerboseLogs, "Verbose HTTP/2 debug logging") } func TestSettingString(t *testing.T) {