summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbestgopher <84328409@qq.com>2024-02-06 03:08:04 +0000
committerGopher Robot <gobot@golang.org>2024-02-29 18:37:32 +0000
commit9fb4a8c9216d09f29d58e45a79cc2065d1b5bbf5 (patch)
treebc9ed9804cdf6737c5dcbafad1346f460065af80
parent3dfd003ad338913e62ad1e56020aee316f1ffe59 (diff)
downloadgolang-x-net-9fb4a8c9216d09f29d58e45a79cc2065d1b5bbf5.tar.gz
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: d1a85d3381f634904fc292c9c0a920dd1341adfd GitHub-Pull-Request: golang/net#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>
-rw-r--r--http2/transport.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/http2/transport.go b/http2/transport.go
index df578b8..c2a5b44 100644
--- a/http2/transport.go
+++ b/http2/transport.go
@@ -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()