You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2015/08/06 06:06:41 UTC

[05/14] trafficserver git commit: TS-3811 HTTP/2 window size must not exceed 2^31-1

TS-3811 HTTP/2 window size must not exceed 2^31-1


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/29243aed
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/29243aed
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/29243aed

Branch: refs/heads/6.0.x
Commit: 29243aed8a21e0267717bce96187903372489964
Parents: 0fc4dcd
Author: maskit <m4...@gmail.com>
Authored: Wed Aug 5 10:09:28 2015 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Wed Aug 5 10:09:28 2015 -0600

----------------------------------------------------------------------
 proxy/http2/Http2ConnectionState.cc | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/29243aed/proxy/http2/Http2ConnectionState.cc
----------------------------------------------------------------------
diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc
index c30dd7a..4244468 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -524,6 +524,17 @@ rcv_window_update_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, co
       return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR);
     }
 
+    // A sender MUST NOT allow a flow-control window to exceed 2^31-1
+    // octets.  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; for the
+    // connection, a GOAWAY frame with an error code of FLOW_CONTROL_ERROR
+    // is sent.
+    if (size > HTTP2_MAX_WINDOW_SIZE - cstate.client_rwnd) {
+      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_FLOW_CONTROL_ERROR);
+    }
+
     cstate.client_rwnd += size;
     cstate.restart_streams();
   } else {
@@ -547,6 +558,17 @@ rcv_window_update_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, co
       return Http2Error(HTTP2_ERROR_CLASS_STREAM, HTTP2_ERROR_PROTOCOL_ERROR);
     }
 
+    // A sender MUST NOT allow a flow-control window to exceed 2^31-1
+    // octets.  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; for the
+    // connection, a GOAWAY frame with an error code of FLOW_CONTROL_ERROR
+    // is sent.
+    if (size > HTTP2_MAX_WINDOW_SIZE - stream->client_rwnd) {
+      return Http2Error(HTTP2_ERROR_CLASS_STREAM, HTTP2_ERROR_FLOW_CONTROL_ERROR);
+    }
+
     stream->client_rwnd += size;
     ssize_t wnd = min(cstate.client_rwnd, stream->client_rwnd);
     if (wnd > 0) {