From 32c70e48d773c95fcce75fffa4b20442ffaa1398 Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Tue, 3 Aug 2021 19:19:07 +0000 Subject: [PATCH 1/2] Fix H2 logic when setting EOS flag on DATA frame --- proxy/http2/Http2ConnectionState.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc index 66855433729..d4188686d5c 100644 --- a/proxy/http2/Http2ConnectionState.cc +++ b/proxy/http2/Http2ConnectionState.cc @@ -1677,6 +1677,8 @@ Http2ConnectionState::send_a_data_frame(Http2Stream *stream, size_t &payload_len payload_length = 0; } + stream->update_sent_count(payload_length); + // Are we at the end? // If we return here, we never send the END_STREAM in the case of a early terminating OS. // OK if there is no body yet. Otherwise continue on to send a DATA frame and delete the stream @@ -1701,8 +1703,6 @@ Http2ConnectionState::send_a_data_frame(Http2Stream *stream, size_t &payload_len Http2DataFrame data(stream->get_id(), flags, resp_reader, payload_length); this->ua_session->xmit(data, flags & HTTP2_FLAGS_DATA_END_STREAM); - stream->update_sent_count(payload_length); - if (flags & HTTP2_FLAGS_DATA_END_STREAM) { Http2StreamDebug(ua_session, stream->get_id(), "END_STREAM"); stream->send_end_stream = true; From dac7a94e374a64c86258ecbb82701985f49e8bed Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Mon, 30 Aug 2021 14:26:06 +0000 Subject: [PATCH 2/2] Remove one more check that will block the EOS --- proxy/http2/Http2ConnectionState.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc index d4188686d5c..6fcfcb12648 100644 --- a/proxy/http2/Http2ConnectionState.cc +++ b/proxy/http2/Http2ConnectionState.cc @@ -1688,7 +1688,7 @@ Http2ConnectionState::send_a_data_frame(Http2Stream *stream, size_t &payload_len return Http2SendDataFrameResult::NO_PAYLOAD; } - if (stream->is_write_vio_done() && !resp_reader->is_read_avail_more_than(0)) { + if (stream->is_write_vio_done()) { flags |= HTTP2_FLAGS_DATA_END_STREAM; }