From 3e215540372196dab6da88ee884555292b8c6bdd Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Mon, 18 Nov 2019 21:12:44 +0000 Subject: [PATCH] Mark EOS on Http/2 Header for responses without body --- proxy/http2/Http2ConnectionState.cc | 4 +++- proxy/http2/Http2Stream.h | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc index b23e0a53e0f..cebe44719e6 100644 --- a/proxy/http2/Http2ConnectionState.cc +++ b/proxy/http2/Http2ConnectionState.cc @@ -1584,7 +1584,9 @@ Http2ConnectionState::send_headers_frame(Http2Stream *stream) if (header_blocks_size <= static_cast(BUFFER_SIZE_FOR_INDEX(buffer_size_index[HTTP2_FRAME_TYPE_HEADERS]))) { payload_length = header_blocks_size; flags |= HTTP2_FLAGS_HEADERS_END_HEADERS; - if (h2_hdr.presence(MIME_PRESENCE_CONTENT_LENGTH) && h2_hdr.get_content_length() == 0) { + + if (is_response_body_precluded(resp_header->status_get(), stream->get_method_wksidx()) || + (h2_hdr.presence(MIME_PRESENCE_CONTENT_LENGTH) && h2_hdr.get_content_length() == 0)) { flags |= HTTP2_FLAGS_HEADERS_END_STREAM; stream->send_end_stream = true; } diff --git a/proxy/http2/Http2Stream.h b/proxy/http2/Http2Stream.h index 6a522a8cf6f..c51c72d3db2 100644 --- a/proxy/http2/Http2Stream.h +++ b/proxy/http2/Http2Stream.h @@ -120,6 +120,7 @@ class Http2Stream : public ProxyTransaction void update_initial_rwnd(Http2WindowSize new_size); bool has_trailing_header() const; void set_request_headers(HTTPHdr &h2_headers); + int get_method_wksidx(); ////////////////// // Variables @@ -316,3 +317,9 @@ Http2Stream::is_first_transaction() const { return is_first_transaction_flag; } + +inline int +Http2Stream::get_method_wksidx() +{ + return _req_header.method_get_wksidx(); +}