Skip to content

Commit 9fb4a8c

Browse files
bestgophergopherbot
authored andcommitted
http2: send an error of FLOW_CONTROL_ERROR when exceed the maximum octets
According to rfc9113 "https://www.rfc-editor.org/rfc/rfc9113.html#section-6.9.1-7", if a sender receives a WINDOW_UPDATE that causes a flow-control window to exceed this maximum, it MUST terminate either the stream or the connection, as appropriate. For streams, the sender sends a RST_STREAM with an error code of FLOW_CONTROL_ERROR. Change-Id: I5e14db247012ebc860a23053f73e70b83c7cd85d GitHub-Last-Rev: d1a85d3 GitHub-Pull-Request: #204 Reviewed-on: https://go-review.googlesource.com/c/net/+/561035 Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
1 parent 3dfd003 commit 9fb4a8c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

http2/transport.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2911,6 +2911,15 @@ func (rl *clientConnReadLoop) processWindowUpdate(f *WindowUpdateFrame) error {
29112911
fl = &cs.flow
29122912
}
29132913
if !fl.add(int32(f.Increment)) {
2914+
// For stream, the sender sends RST_STREAM with an error code of FLOW_CONTROL_ERROR
2915+
if cs != nil {
2916+
rl.endStreamError(cs, StreamError{
2917+
StreamID: f.StreamID,
2918+
Code: ErrCodeFlowControl,
2919+
})
2920+
return nil
2921+
}
2922+
29142923
return ConnectionError(ErrCodeFlowControl)
29152924
}
29162925
cc.cond.Broadcast()

0 commit comments

Comments
 (0)