Skip to content

Commit d1a85d3

Browse files
bestgopher刘洋
authored andcommitted
fix(http2/transport): send an error of FLOW_CONTROL_ERROR when exceed the maximum octets
According to rfc9113, 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. Signed-off-by: bestgopher <[email protected]>
1 parent 73e4b50 commit d1a85d3

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)