You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2016/11/04 14:36:01 UTC
[trafficserver] branch 6.2.x updated: TS-4217: Change stream state
after sending HEADERS frame
This is an automated email from the ASF dual-hosted git repository.
sorber pushed a commit to branch 6.2.x
in repository https://git-dual.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/6.2.x by this push:
new a580a99 TS-4217: Change stream state after sending HEADERS frame
a580a99 is described below
commit a580a994adfc9f7a6dc4aae848286687c479ce17
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Sun Aug 21 23:15:28 2016 +0900
TS-4217: Change stream state after sending HEADERS frame
Change stream state to CLOSED after sending a HEADERS w/ END_STREAM flag to
avoid sending a unnecessary DATA frame w/ END_STREAM flag.
(cherry picked from commit f5c2a2d8d3b4dd4afc1c32ec32627d56c16f78e0)
---
proxy/http2/Http2ConnectionState.cc | 9 +++++++++
proxy/http2/Http2Stream.cc | 3 +++
2 files changed, 12 insertions(+)
diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc
index ab3a4ed..a28b4b3 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -1214,6 +1214,15 @@ Http2ConnectionState::send_headers_frame(Http2Stream *stream)
headers.alloc(buffer_size_index[HTTP2_FRAME_TYPE_HEADERS]);
http2_write_headers(buf, payload_length, headers.write());
headers.finalize(payload_length);
+
+ // Change stream state
+ if (!stream->change_state(HTTP2_FRAME_TYPE_HEADERS, flags)) {
+ this->send_goaway_frame(stream->get_id(), HTTP2_ERROR_PROTOCOL_ERROR);
+ h2_hdr.destroy();
+ ats_free(buf);
+ return;
+ }
+
// xmit event
SCOPED_MUTEX_LOCK(lock, this->ua_session->mutex, this_ethread());
this->ua_session->handleEvent(HTTP2_SESSION_EVENT_XMIT, &headers);
diff --git a/proxy/http2/Http2Stream.cc b/proxy/http2/Http2Stream.cc
index cfdf682..231a743 100644
--- a/proxy/http2/Http2Stream.cc
+++ b/proxy/http2/Http2Stream.cc
@@ -212,6 +212,9 @@ Http2Stream::change_state(uint8_t type, uint8_t flags)
if (type == HTTP2_FRAME_TYPE_RST_STREAM || (type == HTTP2_FRAME_TYPE_HEADERS && flags & HTTP2_FLAGS_HEADERS_END_STREAM) ||
(type == HTTP2_FRAME_TYPE_DATA && flags & HTTP2_FLAGS_DATA_END_STREAM)) {
_state = HTTP2_STREAM_STATE_CLOSED;
+ } else if (type == HTTP2_FRAME_TYPE_HEADERS) { // w/o END_STREAM flag
+ // No state change here. Expect a following DATA frame with END_STREAM flag.
+ return true;
} else {
return false;
}
--
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].