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:39 UTC
[03/14] trafficserver git commit: TS-3799: Fix handling of padding in
DATA frames
TS-3799: Fix handling of padding in DATA frames
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/7d63eae2
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/7d63eae2
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/7d63eae2
Branch: refs/heads/6.0.x
Commit: 7d63eae284d3bbc705d897639957b618fa5ce1b4
Parents: 14f0599
Author: Masakazu Kitajo <m4...@gmail.com>
Authored: Tue Jul 28 06:30:43 2015 +0900
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Wed Aug 5 09:30:36 2015 -0600
----------------------------------------------------------------------
proxy/http2/Http2ConnectionState.cc | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/7d63eae2/proxy/http2/Http2ConnectionState.cc
----------------------------------------------------------------------
diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc
index ca7abeb..3f61b4b 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -91,20 +91,9 @@ rcv_data_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Http2
return HTTP2_ERROR_NO_ERROR;
}
- stream->increment_data_length(payload_length);
- if (frame.header().flags & HTTP2_FLAGS_DATA_END_STREAM) {
- if (!stream->change_state(frame.header().type, frame.header().flags)) {
- cstate.send_rst_stream_frame(id, HTTP2_ERROR_STREAM_CLOSED);
- return HTTP2_ERROR_NO_ERROR;
- }
- if (!stream->payload_length_is_valid()) {
- return HTTP2_ERROR_PROTOCOL_ERROR;
- }
- }
-
if (frame.header().flags & HTTP2_FLAGS_DATA_PADDED) {
frame.reader()->memcpy(&pad_length, HTTP2_DATA_PADLEN_LEN, nbytes);
-
+ nbytes += HTTP2_DATA_PADLEN_LEN;
if (pad_length > payload_length) {
// If the length of the padding is the length of the
// frame payload or greater, the recipient MUST treat this as a
@@ -113,6 +102,17 @@ rcv_data_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Http2
}
}
+ stream->increment_data_length(payload_length - pad_length - nbytes);
+ if (frame.header().flags & HTTP2_FLAGS_DATA_END_STREAM) {
+ if (!stream->change_state(frame.header().type, frame.header().flags)) {
+ cstate.send_rst_stream_frame(id, HTTP2_ERROR_STREAM_CLOSED);
+ return HTTP2_ERROR_NO_ERROR;
+ }
+ if (!stream->payload_length_is_valid()) {
+ return HTTP2_ERROR_PROTOCOL_ERROR;
+ }
+ }
+
// If Data length is 0, do nothing.
if (payload_length == 0) {
return HTTP2_ERROR_NO_ERROR;