This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 8.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/8.1.x by this push:
     new b8a82a4  Do not change stream state from HALF_CLOSED_REMOTE with 
CONTINUATION frame
b8a82a4 is described below

commit b8a82a4250e274ae6ed1603920a9bd54a9ef2c1c
Author: Susan Hinrichs <[email protected]>
AuthorDate: Mon Sep 24 13:19:47 2018 -0500

    Do not change stream state from HALF_CLOSED_REMOTE with CONTINUATION frame
    
    This is a combination of 3 commits.
    
    1. Expand the post chunked tests.
    
    (cherry picked from commit a523a62e2f309694bd6811f8b35eecbc678c24fb)
    
    2. Do not change stream state from HALF_CLOSED_REMOTE with CONTINUATION 
frame
    
    (cherry picked from commit d765d1a33328b43ca83ecc9d0ae39ac01a307a88)
    
    3. Cleanup AuTest for HTTP/2
    
    (cherry picked from commit 76cadf55ece2253c0ddf01a172c57c346f8cd89a)
    
    Conflicts:
        tests/gold_tests/h2/http2.test.py
---
 proxy/http2/Http2Stream.cc                    |  3 +
 tests/gold_tests/h2/gold/http2_8_stderr.gold  | 18 +++++
 tests/gold_tests/h2/gold/http2_8_stdout.gold  |  1 +
 tests/gold_tests/h2/http2.test.py             | 96 ++++++++++++++++++++-------
 tests/gold_tests/h2/rules/huge_resp_hdrs.conf | 24 +++++++
 5 files changed, 117 insertions(+), 25 deletions(-)

diff --git a/proxy/http2/Http2Stream.cc b/proxy/http2/Http2Stream.cc
index d1c37f6..5af0ef1 100644
--- a/proxy/http2/Http2Stream.cc
+++ b/proxy/http2/Http2Stream.cc
@@ -250,6 +250,9 @@ Http2Stream::change_state(uint8_t type, uint8_t flags)
     } 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 if (type == HTTP2_FRAME_TYPE_CONTINUATION) { // w/o END_STREAM flag
+      // No state change here. Expect a following DATA frame with END_STREAM 
flag.
+      return true;
     } else {
       // Error, set state closed
       _state = Http2StreamState::HTTP2_STREAM_STATE_CLOSED;
diff --git a/tests/gold_tests/h2/gold/http2_8_stderr.gold 
b/tests/gold_tests/h2/gold/http2_8_stderr.gold
new file mode 100644
index 0000000..f5d57eb
--- /dev/null
+++ b/tests/gold_tests/h2/gold/http2_8_stderr.gold
@@ -0,0 +1,18 @@
+``
+> GET /huge_resp_hdrs HTTP/2
+> Host: ``
+> User-Agent: curl/``
+> Accept: */*
+``
+< HTTP/2 200 ``
+< server: ATS/``
+< content-length: 6
+< date: ``
+< age: ``
+< x-huge-0: 
0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789ab
 [...]
+< x-huge-1: 
0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789ab
 [...]
+< x-huge-2: 
0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789ab
 [...]
+< x-huge-3: 
0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789ab
 [...]
+< x-huge-4: 
0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789ab
 [...]
+< x-huge-5: 
0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789ab
 [...]
+``
diff --git a/tests/gold_tests/h2/gold/http2_8_stdout.gold 
b/tests/gold_tests/h2/gold/http2_8_stdout.gold
new file mode 100644
index 0000000..fb1fe7d
--- /dev/null
+++ b/tests/gold_tests/h2/gold/http2_8_stdout.gold
@@ -0,0 +1 @@
+200 OK``
diff --git a/tests/gold_tests/h2/http2.test.py 
b/tests/gold_tests/h2/http2.test.py
index 7065c05..e3f2562 100644
--- a/tests/gold_tests/h2/http2.test.py
+++ b/tests/gold_tests/h2/http2.test.py
@@ -18,7 +18,7 @@
 
 import os
 Test.Summary = '''
-Test a basic remap of a http connection
+Test a basic remap of a http/2 connection
 '''
 # need Curl
 Test.SkipUnless(
@@ -26,43 +26,65 @@ Test.SkipUnless(
     Condition.HasCurlFeature('http2')
 )
 Test.ContinueOnFail = True
-# Define default ATS
-ts = Test.MakeATSProcess("ts", select_ports=False)
+
+# ----
+# Setup Origin Server
+# ----
 server = Test.MakeOriginServer("server")
 
-requestLocation = "test2"
-reHost = "www.example.com"
-
-testName = ""
-request_header = {"headers": "GET / HTTP/1.1\r\nHost: 
www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
-# desired response form the origin server
-response_header = {"headers": "HTTP/1.1 200 OK\r\nServer: 
microserver\r\nConnection: close\r\n\r\n",
-                   "timestamp": "1469733493.993", "body": ""}
-request_header2 = {
-    "headers": "GET /{0} HTTP/1.1\r\nHost: 
{1}\r\n\r\n".format(requestLocation, reHost), "timestamp": "1469733493.993", 
"body": ""}
-# desired response form the origin server
-response_header2 = {"headers": "HTTP/1.1 200 OK\r\nServer: 
microserver\r\nTransfer-Encoding: chunked\r\nConnection: close\r\n\r\n",
-                    "timestamp": "1469733493.993", "body": ""}
-server.addResponse("sessionlog.json", request_header, response_header)
+# For Test Case 1 & 5 - /
+server.addResponse("sessionlog.json",
+                   {"headers": "GET / HTTP/1.1\r\nHost: 
www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""},
+                   {"headers": "HTTP/1.1 200 OK\r\nServer: 
microserver\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", 
"body": ""})
 
+# For Test Case 2 - /bigfile
 # Add info for the large H2 download test
 server.addResponse("sessionlog.json",
                    {"headers": "GET /bigfile HTTP/1.1\r\nHost: 
www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""},
                    {"headers": "HTTP/1.1 200 OK\r\nServer: 
microserver\r\nConnection: close\r\nCache-Control: 
max-age=3600\r\nContent-Length: 191414\r\n\r\n", "timestamp": "1469733493.993", 
"body": ""})
 
+# For Test Case 3 - /test2
+server.addResponse("sessionlog.json",
+                   {"headers": "GET /test2 HTTP/1.1\r\nHost: 
www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""},
+                   {"headers": "HTTP/1.1 200 OK\r\nServer: 
microserver\r\nTransfer-Encoding: chunked\r\nConnection: close\r\n\r\n", 
"timestamp": "1469733493.993", "body": ""})
+
+# For Test Case 6 - /postchunked
 post_body = 
"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
 server.addResponse("sessionlog.jason",
-                   {"headers": "POST /postchunked HTTP/1.1\r\nHost: 
www.example.com\r\n\r\n",
-                    "timestamp": "1469733493.993",
-                     "body": post_body},
+                   {"headers": "POST /postchunked HTTP/1.1\r\nHost: 
www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": post_body},
+                   {"headers": "HTTP/1.1 200 OK\r\nServer: 
microserver\r\nConnection: close\r\nContent-Length: 10\r\n\r\n", "timestamp": 
"1469733493.993", "body": "0123456789"})
+
+# For Test Case 7 - /bigpostchunked
+# Make a post body that will be split across at least two frames
+big_post_body = "0123456789" * 131070
+server.addResponse("sessionlog.jason",
+                   {"headers": "POST /bigpostchunked HTTP/1.1\r\nHost: 
www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": big_post_body},
                    {"headers": "HTTP/1.1 200 OK\r\nServer: 
microserver\r\nConnection: close\r\nContent-Length: 10\r\n\r\n", "timestamp": 
"1469733493.993", "body": "0123456789"})
 
-server.addResponse("sessionlog.json", request_header2, response_header2)
+big_post_body_file = open(os.path.join(Test.RunDirectory, "big_post_body"), 
"w")
+big_post_body_file.write(big_post_body)
+big_post_body_file.close()
+
+# For Test Case 8 - /huge_resp_hdrs
+server.addResponse("sessionlog.json",
+                   {"headers": "GET /huge_resp_hdrs HTTP/1.1\r\nHost: 
www.example.com\r\n\r\n", "timestamp": "1469733493.993", "body": ""},
+                   {"headers": "HTTP/1.1 200 OK\r\nServer: 
microserver\r\nConnection: close\r\nContent-Length: 6\r\n\r\n", "timestamp": 
"1469733493.993", "body": "200 OK"})
+
+# ----
+# Setup ATS
+# ----
+ts = Test.MakeATSProcess("ts", select_ports=True, enable_tls=True)
+
 # add ssl materials like key, certificates for the server
 ts.addSSLfile("ssl/server.pem")
 ts.addSSLfile("ssl/server.key")
 
 ts.Variables.ssl_port = 4443
+ts.Setup.CopyAs('rules/huge_resp_hdrs.conf', Test.RunDirectory)
+ts.Disk.remap_config.AddLine(
+    'map /huge_resp_hdrs http://127.0.0.1:{0}/huge_resp_hdrs 
@plugin=header_rewrite.so @pparam={1}/huge_resp_hdrs.conf 
'.format(server.Variables.Port, Test.RunDirectory)
+)
+
 ts.Disk.remap_config.AddLine(
     'map / http://127.0.0.1:{0}'.format(server.Variables.Port)
 )
@@ -72,7 +94,7 @@ ts.Disk.ssl_multicert_config.AddLine(
 )
 ts.Disk.records_config.update({
     'proxy.config.diags.debug.enabled': 1,
-    'proxy.config.diags.debug.tags': 'http2',
+    'proxy.config.diags.debug.tags': 'http',
     'proxy.config.ssl.server.cert.path': '{0}'.format(ts.Variables.SSLDir),
     'proxy.config.ssl.server.private_key.path': 
'{0}'.format(ts.Variables.SSLDir),
     # enable ssl port
@@ -83,11 +105,16 @@ ts.Disk.records_config.update({
     'proxy.config.http2.active_timeout_in': 3,
     'proxy.config.http2.max_concurrent_streams_in': 65535,
 })
+
 ts.Setup.CopyAs('h2client.py', Test.RunDirectory)
 ts.Setup.CopyAs('h2bigclient.py', Test.RunDirectory)
 ts.Setup.CopyAs('h2chunked.py', Test.RunDirectory)
 ts.Setup.CopyAs('h2active_timeout.py', Test.RunDirectory)
 
+# ----
+# Test Cases
+# ----
+
 # Test Case 1:  basic H2 interaction
 tr = Test.AddTestRun()
 tr.Processes.Default.Command = 'python3 h2client.py -p 
{0}'.format(ts.Variables.ssl_port)
@@ -107,7 +134,7 @@ tr.StillRunningAfter = server
 
 # Test Case 3: Chunked content
 tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'python3 h2chunked.py -p {0}  -u 
/{1}'.format(ts.Variables.ssl_port, requestLocation)
+tr.Processes.Default.Command = 'python3 h2chunked.py -p {0}  -u 
/test2'.format(ts.Variables.ssl_port)
 tr.Processes.Default.ReturnCode = 0
 tr.Processes.Default.Streams.stdout = "gold/chunked.gold"
 tr.StillRunningAfter = server
@@ -122,7 +149,7 @@ tr.StillRunningAfter = server
 # tr.Processes.Default.Streams.stdout = "gold/replay.gold"
 # tr.StillRunningAfter = server
 
-# Test Case 5:h2_active_timeout
+# Test Case 5: h2_active_timeout
 tr = Test.AddTestRun()
 tr.Processes.Default.Command = 'python3 h2active_timeout.py -p 
{0}'.format(ts.Variables.ssl_port)
 tr.Processes.Default.ReturnCode = 0
@@ -130,8 +157,27 @@ tr.Processes.Default.Streams.All = 
"gold/active_timeout.gold"
 tr.StillRunningAfter = server
 
 # Test Case 6: Post with chunked body
+# While HTTP/2 does not support Tranfer-encoding we pass that into curl to 
encourage it to not set the content length
+# on the post body
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = 'curl -s -k -H "Transfer-Encoding: chunked" -d 
"{0}" https://127.0.0.1:{1}/postchunked'.format(post_body, 
ts.Variables.ssl_port)
+tr.Processes.Default.ReturnCode = 0
+tr.Processes.Default.Streams.All = "gold/post_chunked.gold"
+tr.StillRunningAfter = server
+
+# Test Case 7: Post with big chunked body
+# While HTTP/2 does not support Tranfer-encoding we pass that into curl to 
encourage it to not set the content length
+# on the post body
 tr = Test.AddTestRun()
-tr.Processes.Default.Command = 'curl -s -k -H "Transfer-Encoding: chunked" -d 
"{0}" https://127.0.0.1:{1}/postchunked'.format( post_body, 
ts.Variables.ssl_port)
+tr.Processes.Default.Command = 'curl -s -k -H "Transfer-Encoding: chunked" -d 
@big_post_body 
https://127.0.0.1:{0}/bigpostchunked'.format(ts.Variables.ssl_port)
 tr.Processes.Default.ReturnCode = 0
 tr.Processes.Default.Streams.All = "gold/post_chunked.gold"
 tr.StillRunningAfter = server
+
+# Test Case 8: Huge resposne header
+tr = Test.AddTestRun()
+tr.Processes.Default.Command = 'curl -vs -k --http2 
https://127.0.0.1:{0}/huge_resp_hdrs'.format(ts.Variables.ssl_port)
+tr.Processes.Default.ReturnCode = 0
+tr.Processes.Default.Streams.stdout = "gold/http2_8_stdout.gold"
+tr.Processes.Default.Streams.stderr = "gold/http2_8_stderr.gold"
+tr.StillRunningAfter = server
diff --git a/tests/gold_tests/h2/rules/huge_resp_hdrs.conf 
b/tests/gold_tests/h2/rules/huge_resp_hdrs.conf
new file mode 100644
index 0000000..068bd25
--- /dev/null
+++ b/tests/gold_tests/h2/rules/huge_resp_hdrs.conf
@@ -0,0 +1,24 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+cond %{SEND_RESPONSE_HDR_HOOK}
+  set-header X-HUGE-0 
"0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0
 [...]
+  set-header X-HUGE-1 
"0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0
 [...]
+  set-header X-HUGE-2 
"0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0
 [...]
+  set-header X-HUGE-3 
"0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0
 [...]
+  set-header X-HUGE-4 
"0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0
 [...]
+  set-header X-HUGE-5 
"0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0
 [...]

Reply via email to