Skip to content

Commit

Permalink
http2: send an error of FLOW_CONTROL_ERROR when exceed the maximum oc…
Browse files Browse the repository at this point in the history
…tets

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 <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Carlos Amedee <[email protected]>
Reviewed-by: Damien Neil <[email protected]>
  • Loading branch information
bestgopher authored and gopherbot committed Feb 29, 2024
1 parent 3dfd003 commit 9fb4a8c
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 9fb4a8c

Please sign in to comment.