"encoding/binary"
"errors"
"fmt"
- "golang.org/x/net/http2/hpack"
"io"
"io/ioutil"
"log"
"strings"
"sync"
"time"
+
+ "golang.org/x/net/http2/hpack"
)
// ClientConnPool manages a pool of HTTP/2 client connections.
// other HTTP/2 implementations' conformance to the spec.
AllowIllegalReads bool
+ logReads bool
+
debugFramer *http2Framer // only use for logging written writes
debugFramerBuf *bytes.Buffer
}
if f.debugFramer == nil {
f.debugFramerBuf = new(bytes.Buffer)
f.debugFramer = http2NewFramer(nil, f.debugFramerBuf)
+ f.debugFramer.logReads = false
f.debugFramer.AllowIllegalReads = true
}
// 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) {
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
}
var (
http2VerboseLogs bool
http2logFrameWrites bool
+ http2logFrameReads bool
)
func init() {
if strings.Contains(e, "http2debug=2") {
http2VerboseLogs = true
http2logFrameWrites = true
+ http2logFrameReads = true
}
}