Commit 525d4bd5 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

net/http: update http2 bundle

To rev a179abb (handle Transport PING frames).

Change-Id: I6e1eef2c9586c23f231803d9364d921248722f12
Reviewed-on: https://go-review.googlesource.com/16732Reviewed-by: default avatarBlake Mizerany <blake.mizerany@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 5e03c84a
...@@ -832,6 +832,8 @@ type http2PingFrame struct { ...@@ -832,6 +832,8 @@ type http2PingFrame struct {
Data [8]byte Data [8]byte
} }
func (f *http2PingFrame) IsAck() bool { return f.Flags.Has(http2FlagPingAck) }
func http2parsePingFrame(fh http2FrameHeader, payload []byte) (http2Frame, error) { func http2parsePingFrame(fh http2FrameHeader, payload []byte) (http2Frame, error) {
if len(payload) != 8 { if len(payload) != 8 {
return nil, http2ConnectionError(http2ErrCodeFrameSize) return nil, http2ConnectionError(http2ErrCodeFrameSize)
...@@ -2824,7 +2826,7 @@ func (sc *http2serverConn) processFrame(f http2Frame) error { ...@@ -2824,7 +2826,7 @@ func (sc *http2serverConn) processFrame(f http2Frame) error {
func (sc *http2serverConn) processPing(f *http2PingFrame) error { func (sc *http2serverConn) processPing(f *http2PingFrame) error {
sc.serveG.check() sc.serveG.check()
if f.Flags.Has(http2FlagSettingsAck) { if f.IsAck() {
return nil return nil
} }
...@@ -4279,6 +4281,8 @@ func (rl *http2clientConnReadLoop) run() error { ...@@ -4279,6 +4281,8 @@ func (rl *http2clientConnReadLoop) run() error {
err = rl.processPushPromise(f) err = rl.processPushPromise(f)
case *http2WindowUpdateFrame: case *http2WindowUpdateFrame:
err = rl.processWindowUpdate(f) err = rl.processWindowUpdate(f)
case *http2PingFrame:
err = rl.processPing(f)
default: default:
cc.logf("Transport: unhandled response frame type %T", f) cc.logf("Transport: unhandled response frame type %T", f)
} }
...@@ -4496,6 +4500,20 @@ func (rl *http2clientConnReadLoop) processResetStream(f *http2RSTStreamFrame) er ...@@ -4496,6 +4500,20 @@ func (rl *http2clientConnReadLoop) processResetStream(f *http2RSTStreamFrame) er
return nil return nil
} }
func (rl *http2clientConnReadLoop) processPing(f *http2PingFrame) error {
if f.IsAck() {
return nil
}
cc := rl.cc
cc.wmu.Lock()
defer cc.wmu.Unlock()
if err := cc.fr.WritePing(true, f.Data); err != nil {
return err
}
return cc.bw.Flush()
}
func (rl *http2clientConnReadLoop) processPushPromise(f *http2PushPromiseFrame) error { func (rl *http2clientConnReadLoop) processPushPromise(f *http2PushPromiseFrame) error {
return http2ConnectionError(http2ErrCodeProtocol) return http2ConnectionError(http2ErrCodeProtocol)
......
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