trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject trafficserver git commit: TS-3811 HTTP/2 window size must not exceed 2^31-1
Date Wed, 05 Aug 2015 16:10:13 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 0fc4dcdea -> 29243aed8


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/master
Commit: 29243aed8a21e0267717bce96187903372489964
Parents: 0fc4dcd
Author: maskit <m4sk17@gmail.com>
Authored: Wed Aug 5 10:09:28 2015 -0600
Committer: Leif Hedstrom <zwoop@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) {


Mime
View raw message