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

trafficserver git commit: TS-3836: Add error handling of Stream Priority

Repository: trafficserver
Updated Branches:
  refs/heads/master 99962a632 -> 728f2c3a8


TS-3836: Add error handling of Stream Priority


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

Branch: refs/heads/master
Commit: 728f2c3a80c2a5947bed7d3bf1865f1a1a52d3f4
Parents: 99962a6
Author: Bryan Call <bc...@apache.org>
Authored: Sat Aug 15 16:11:05 2015 -0700
Committer: Bryan Call <bc...@apache.org>
Committed: Sat Aug 15 16:11:05 2015 -0700

----------------------------------------------------------------------
 proxy/http2/HTTP2.cc                | 2 +-
 proxy/http2/Http2ConnectionState.cc | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/728f2c3a/proxy/http2/HTTP2.cc
----------------------------------------------------------------------
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index a8450e2..39a68cf 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -347,7 +347,7 @@ http2_parse_priority_parameter(IOVec iov, Http2Priority &params)
   memcpy_and_advance(dependency.bytes, ptr);
   memcpy_and_advance(params.weight, ptr);
 
-  params.stream_dependency = ntohs(dependency.value);
+  params.stream_dependency = ntohl(dependency.value);
 
   return true;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/728f2c3a/proxy/http2/Http2ConnectionState.cc
----------------------------------------------------------------------
diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc
index 03e9583..9714ee4 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -233,6 +233,10 @@ rcv_headers_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Ht
     if (!http2_parse_priority_parameter(make_iovec(buf, HTTP2_PRIORITY_LEN), params.priority)) {
       return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR);
     }
+    // Protocol error if the stream depends on itself
+    if (stream_id == params.priority.stream_dependency) {
+      return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR);
+    }
 
     header_block_fragment_offset += HTTP2_PRIORITY_LEN;
     header_block_fragment_length -= HTTP2_PRIORITY_LEN;