diff --git a/proxy/http2/Http2Stream.cc b/proxy/http2/Http2Stream.cc index 9f83206f38c..143058f5dfb 100644 --- a/proxy/http2/Http2Stream.cc +++ b/proxy/http2/Http2Stream.cc @@ -298,7 +298,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 1487943ef0d..e8e9acabd41 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 -``(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 4c662651bb0..8cc94f749f2 100644 --- a/tests/gold_tests/h2/nghttp.test.py +++ b/tests/gold_tests/h2/nghttp.test.py @@ -29,7 +29,6 @@ # ---- # Setup Origin Server # ---- -microserver = Test.MakeOriginServer("microserver") httpbin = Test.MakeHttpBinServer("httpbin") # 128KB @@ -38,15 +37,6 @@ 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.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 @@ # 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.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