Repository: trafficserver Updated Branches: refs/heads/6.0.x 16169389c -> 0ff9f34a2
TS-3836: Add error handling of Stream Priority (cherry picked from commit 728f2c3a80c2a5947bed7d3bf1865f1a1a52d3f4) Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/0ff9f34a Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/0ff9f34a Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/0ff9f34a Branch: refs/heads/6.0.x Commit: 0ff9f34a2014059f6224efd82eb71ced4ef6d567 Parents: 1616938 Author: Bryan Call <[email protected]> Authored: Sat Aug 15 16:11:05 2015 -0700 Committer: Bryan Call <[email protected]> Committed: Tue Aug 25 13:25:13 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/0ff9f34a/proxy/http2/HTTP2.cc ---------------------------------------------------------------------- diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc index d77242c..b0ced22 100644 --- a/proxy/http2/HTTP2.cc +++ b/proxy/http2/HTTP2.cc @@ -345,7 +345,7 @@ http2_parse_priority_parameter(IOVec iov, Http2Priority ¶ms) 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/0ff9f34a/proxy/http2/Http2ConnectionState.cc ---------------------------------------------------------------------- diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc index 4e34a8f..54d9148 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;
