Skip to content

Commit

Permalink
fix(http2/transport): send an error of FLOW_CONTROL_ERROR when exceed…
Browse files Browse the repository at this point in the history
… 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 <84328409@qq.com>
  • Loading branch information
bestgopher authored and 刘洋 committed Feb 6, 2024
1 parent 73e4b50 commit d1a85d3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions http2/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -2911,6 +2911,15 @@ func (rl *clientConnReadLoop) processWindowUpdate(f *WindowUpdateFrame) error {
fl = &cs.flow
}
if !fl.add(int32(f.Increment)) {
// For stream, the sender sends RST_STREAM with an error code of FLOW_CONTROL_ERROR
if cs != nil {
rl.endStreamError(cs, StreamError{
StreamID: f.StreamID,
Code: ErrCodeFlowControl,
})
return nil
}

return ConnectionError(ErrCodeFlowControl)
}
cc.cond.Broadcast()
Expand Down

0 comments on commit d1a85d3

Please sign in to comment.