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 2021/11/08 18:59:16 UTC
[trafficserver] branch 9.1.x updated: Fix stall on sending response
for request with trailer header (#7831)
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.1.x by this push:
new 8ab60bc Fix stall on sending response for request with trailer header (#7831)
8ab60bc is described below
commit 8ab60bc5799c7488a0a62047541ffd7e9715a624
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Fri May 14 08:53:27 2021 +0900
Fix stall on sending response for request with trailer header (#7831)
(cherry picked from commit 183d3761c7ffd92082f85cf6b3411127506298be)
---
proxy/http2/Http2Stream.cc | 2 +-
tests/gold_tests/h2/gold/nghttp_0_stdout.gold | 3 +--
tests/gold_tests/h2/nghttp.test.py | 19 +++----------------
3 files changed, 5 insertions(+), 19 deletions(-)
diff --git a/proxy/http2/Http2Stream.cc b/proxy/http2/Http2Stream.cc
index ffd2e64..5c79577 100644
--- a/proxy/http2/Http2Stream.cc
+++ b/proxy/http2/Http2Stream.cc
@@ -305,7 +305,7 @@ Http2Stream::change_state(uint8_t type, uint8_t flags)
case Http2StreamState::HTTP2_STREAM_STATE_OPEN:
if (type == HTTP2_FRAME_TYPE_RST_STREAM) {
_state = Http2StreamState::HTTP2_STREAM_STATE_CLOSED;
- } else if (type == HTTP2_FRAME_TYPE_DATA) {
+ } else if (type == HTTP2_FRAME_TYPE_HEADERS || type == HTTP2_FRAME_TYPE_DATA) {
if (recv_end_stream) {
_state = Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE;
} else if (send_end_stream) {
diff --git a/tests/gold_tests/h2/gold/nghttp_0_stdout.gold b/tests/gold_tests/h2/gold/nghttp_0_stdout.gold
index 1487943..e8e9aca 100644
--- a/tests/gold_tests/h2/gold/nghttp_0_stdout.gold
+++ b/tests/gold_tests/h2/gold/nghttp_0_stdout.gold
@@ -12,6 +12,5 @@
``
[``] recv (stream_id=1) :status: 200
``
-[``] recv RST_STREAM frame <length=4, flags=0x00, stream_id=1>
-``(error_code=NO_ERROR(0x00))
+``; END_STREAM
``
diff --git a/tests/gold_tests/h2/nghttp.test.py b/tests/gold_tests/h2/nghttp.test.py
index 4c66265..8cc94f7 100644
--- a/tests/gold_tests/h2/nghttp.test.py
+++ b/tests/gold_tests/h2/nghttp.test.py
@@ -29,7 +29,6 @@ Test.ContinueOnFail = True
# ----
# Setup Origin Server
# ----
-microserver = Test.MakeOriginServer("microserver")
httpbin = Test.MakeHttpBinServer("httpbin")
# 128KB
@@ -38,15 +37,6 @@ post_body_file = open(os.path.join(Test.RunDirectory, "post_body"), "w")
post_body_file.write(post_body)
post_body_file.close()
-# For Test Case 0
-microserver.addResponse("sessionlog.json",
- {"headers": "POST /post HTTP/1.1\r\nHost: www.example.com\r\nTrailer: foo\r\n\r\n",
- "timestamp": "1469733493.993",
- "body": post_body},
- {"headers": "HTTP/1.1 200 OK\r\nServer: microserver\r\nConnection: close\r\n\r\n",
- "timestamp": "1469733493.993",
- "body": ""})
-
# ----
# Setup ATS
# ----
@@ -59,7 +49,6 @@ ts.addDefaultSSLFiles()
ts.Setup.CopyAs('rules/graceful_shutdown.conf', Test.RunDirectory)
ts.Disk.remap_config.AddLines([
- 'map /post http://127.0.0.1:{0}/post'.format(microserver.Variables.Port),
'map /httpbin/ http://127.0.0.1:{0}/ @plugin=header_rewrite.so @pparam={1}/graceful_shutdown.conf'.format(
httpbin.Variables.Port, Test.RunDirectory)
])
@@ -82,13 +71,12 @@ ts.Disk.records_config.update({
# Test Case 0: Trailer
tr = Test.AddTestRun()
tr.TimeOut = 10
-tr.Processes.Default.Command = "nghttp -v --no-dep 'https://127.0.0.1:{0}/post' --trailer 'foo: bar' -d 'post_body'".format(
- ts.Variables.ssl_port)
+tr.Processes.Default.Command = f"nghttp -vn --no-dep 'https://127.0.0.1:{ts.Variables.ssl_port}/httpbin/post' --trailer 'foo: bar' -d 'post_body'"
tr.Processes.Default.ReturnCode = 0
-tr.Processes.Default.StartBefore(microserver, ready=When.PortOpen(microserver.Variables.Port))
+tr.Processes.Default.StartBefore(httpbin, ready=When.PortOpen(httpbin.Variables.Port))
tr.Processes.Default.StartBefore(Test.Processes.ts)
tr.Processes.Default.Streams.stdout = "gold/nghttp_0_stdout.gold"
-tr.StillRunningAfter = microserver
+tr.StillRunningAfter = httpbin
tr.StillRunningAfter = ts
# Test Case 1: Graceful Shutdown
@@ -98,7 +86,6 @@ tr = Test.AddTestRun()
tr.TimeOut = 10
tr.Processes.Default.Command = f"nghttp -vn --no-dep 'https://127.0.0.1:{ts.Variables.ssl_port}/httpbin/drip?duration=3'"
tr.Processes.Default.ReturnCode = 0
-tr.Processes.Default.StartBefore(httpbin, ready=When.PortOpen(httpbin.Variables.Port))
tr.Processes.Default.Streams.stdout = "gold/nghttp_1_stdout.gold"
tr.StillRunningAfter = httpbin
tr.StillRunningAfter = ts