From eeb38a8270788d347f5d10fcaf909767c4468b2d Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Mon, 24 May 2021 18:18:00 +0000 Subject: [PATCH 01/12] Fail requests with incomplete line ends --- proxy/hdrs/MIME.cc | 9 ++------- .../data/www.customplugin204.test_get.txt | 4 ++-- .../data/www.customtemplate204.test_get.txt | 4 ++-- .../data/www.default204.test_get.txt | 4 ++-- .../data/www.default304.test_get.txt | 4 ++-- .../data/www.example.test_get_200.txt | 6 +++--- .../data/www.example.test_get_304.txt | 8 ++++---- .../body_factory/data/www.example.test_head.txt | 6 +++--- .../data/www.example.test_head_200.txt | 6 +++--- .../gold_tests/headers/data/www.http408.test.txt | 10 +++++----- .../headers/data/www.passthrough.test_get.txt | 4 ++-- .../headers/data/www.redirect0.test_get.txt | 4 ++-- .../headers/data/www.redirect301.test_get.txt | 4 ++-- .../headers/data/www.redirect302.test_get.txt | 4 ++-- .../headers/data/www.redirect307.test_get.txt | 4 ++-- .../headers/data/www.redirect308.test_get.txt | 4 ++-- .../combo_handler/combo_handler.test.py | 16 ++++++++-------- tests/tools/tcp_client.py | 5 +++-- 18 files changed, 51 insertions(+), 55 deletions(-) diff --git a/proxy/hdrs/MIME.cc b/proxy/hdrs/MIME.cc index b88c5d5b954..7a521b57e15 100644 --- a/proxy/hdrs/MIME.cc +++ b/proxy/hdrs/MIME.cc @@ -2349,8 +2349,6 @@ ParseResult MIMEScanner::get(TextView &input, TextView &output, bool &output_shares_input, bool eof_p, ScanType scan_type) { ParseResult zret = PARSE_RESULT_CONT; - // Need this for handling dangling CR. - static const char RAW_CR{ParseRules::CHAR_CR}; auto text = input; while (PARSE_RESULT_CONT == zret && !text.empty()) { @@ -2368,7 +2366,7 @@ MIMEScanner::get(TextView &input, TextView &output, bool &output_shares_input, b } } else if (ParseRules::is_lf(*text)) { ++text; - zret = PARSE_RESULT_DONE; // Required by regression test. + zret = PARSE_RESULT_ERROR; // lone LF } else { // consume this character in the next state. m_state = MIME_PARSE_INSIDE; @@ -2380,10 +2378,7 @@ MIMEScanner::get(TextView &input, TextView &output, bool &output_shares_input, b ++text; zret = PARSE_RESULT_DONE; } else { - // This really should be an error (spec doesn't permit lone CR) but the regression tests - // require it. - this->append(TextView(&RAW_CR, 1)); // This is to fix a core dump of the icc 19.1 compiler when {&RAW_CR, 1} is used - m_state = MIME_PARSE_INSIDE; + zret = PARSE_RESULT_ERROR; // lone CR } break; case MIME_PARSE_INSIDE: { diff --git a/tests/gold_tests/body_factory/data/www.customplugin204.test_get.txt b/tests/gold_tests/body_factory/data/www.customplugin204.test_get.txt index 4cf018aea16..be603f95f17 100644 --- a/tests/gold_tests/body_factory/data/www.customplugin204.test_get.txt +++ b/tests/gold_tests/body_factory/data/www.customplugin204.test_get.txt @@ -1,2 +1,2 @@ -GET HTTP://www.customplugin204.test/ HTTP/1.1 - +GET HTTP://www.customplugin204.test/ HTTP/1.1 + diff --git a/tests/gold_tests/body_factory/data/www.customtemplate204.test_get.txt b/tests/gold_tests/body_factory/data/www.customtemplate204.test_get.txt index f16fbc74628..395d7985f69 100644 --- a/tests/gold_tests/body_factory/data/www.customtemplate204.test_get.txt +++ b/tests/gold_tests/body_factory/data/www.customtemplate204.test_get.txt @@ -1,2 +1,2 @@ -GET HTTP://www.customtemplate204.test/ HTTP/1.1 - +GET HTTP://www.customtemplate204.test/ HTTP/1.1 + diff --git a/tests/gold_tests/body_factory/data/www.default204.test_get.txt b/tests/gold_tests/body_factory/data/www.default204.test_get.txt index 1a421ddf182..e77408af827 100644 --- a/tests/gold_tests/body_factory/data/www.default204.test_get.txt +++ b/tests/gold_tests/body_factory/data/www.default204.test_get.txt @@ -1,2 +1,2 @@ -GET HTTP://www.default204.test/ HTTP/1.1 - +GET HTTP://www.default204.test/ HTTP/1.1 + diff --git a/tests/gold_tests/body_factory/data/www.default304.test_get.txt b/tests/gold_tests/body_factory/data/www.default304.test_get.txt index d251435b982..c9064fa0ade 100644 --- a/tests/gold_tests/body_factory/data/www.default304.test_get.txt +++ b/tests/gold_tests/body_factory/data/www.default304.test_get.txt @@ -1,2 +1,2 @@ -GET HTTP://www.default304.test/ HTTP/1.1 - +GET HTTP://www.default304.test/ HTTP/1.1 + diff --git a/tests/gold_tests/body_factory/data/www.example.test_get_200.txt b/tests/gold_tests/body_factory/data/www.example.test_get_200.txt index 5994603557f..c53681f3486 100644 --- a/tests/gold_tests/body_factory/data/www.example.test_get_200.txt +++ b/tests/gold_tests/body_factory/data/www.example.test_get_200.txt @@ -1,3 +1,3 @@ -GET /get200 HTTP/1.1 -Host: www.example.test - +GET /get200 HTTP/1.1 +Host: www.example.test + diff --git a/tests/gold_tests/body_factory/data/www.example.test_get_304.txt b/tests/gold_tests/body_factory/data/www.example.test_get_304.txt index 03a8d5967eb..8d0aecf9bdb 100644 --- a/tests/gold_tests/body_factory/data/www.example.test_get_304.txt +++ b/tests/gold_tests/body_factory/data/www.example.test_get_304.txt @@ -1,4 +1,4 @@ -GET /get304 HTTP/1.1 -Host: www.example.test -If-Modified-Since: Thu, 1 Jan 1970 00:00:00 GMT - +GET /get304 HTTP/1.1 +Host: www.example.test +If-Modified-Since: Thu, 1 Jan 1970 00:00:00 GMT + diff --git a/tests/gold_tests/body_factory/data/www.example.test_head.txt b/tests/gold_tests/body_factory/data/www.example.test_head.txt index 514c1071065..c5a5c979e9e 100644 --- a/tests/gold_tests/body_factory/data/www.example.test_head.txt +++ b/tests/gold_tests/body_factory/data/www.example.test_head.txt @@ -1,3 +1,3 @@ -HEAD http://www.example.test/ HTTP/1.1 -Host: www.example.test - +HEAD http://www.example.test/ HTTP/1.1 +Host: www.example.test + diff --git a/tests/gold_tests/body_factory/data/www.example.test_head_200.txt b/tests/gold_tests/body_factory/data/www.example.test_head_200.txt index fc0f1d536fd..6d214e1b365 100644 --- a/tests/gold_tests/body_factory/data/www.example.test_head_200.txt +++ b/tests/gold_tests/body_factory/data/www.example.test_head_200.txt @@ -1,3 +1,3 @@ -HEAD /head200 HTTP/1.1 -Host: www.example.test - +HEAD /head200 HTTP/1.1 +Host: www.example.test + diff --git a/tests/gold_tests/headers/data/www.http408.test.txt b/tests/gold_tests/headers/data/www.http408.test.txt index 81f9f9893e5..4e3be6c5294 100644 --- a/tests/gold_tests/headers/data/www.http408.test.txt +++ b/tests/gold_tests/headers/data/www.http408.test.txt @@ -1,5 +1,5 @@ -POST / HTTP/1.1 -Host: www.http408.test -Content-Length: 100 - -arbitrary content \ No newline at end of file +POST / HTTP/1.1 +Host: www.http408.test +Content-Length: 100 + +arbitrary content diff --git a/tests/gold_tests/headers/data/www.passthrough.test_get.txt b/tests/gold_tests/headers/data/www.passthrough.test_get.txt index ffe69c2afd9..0cba742da68 100644 --- a/tests/gold_tests/headers/data/www.passthrough.test_get.txt +++ b/tests/gold_tests/headers/data/www.passthrough.test_get.txt @@ -1,2 +1,2 @@ -GET http://www.passthrough.test/ HTTP/1.1 - +GET http://www.passthrough.test/ HTTP/1.1 + diff --git a/tests/gold_tests/headers/data/www.redirect0.test_get.txt b/tests/gold_tests/headers/data/www.redirect0.test_get.txt index 3d3d219e385..40fce98c217 100644 --- a/tests/gold_tests/headers/data/www.redirect0.test_get.txt +++ b/tests/gold_tests/headers/data/www.redirect0.test_get.txt @@ -1,2 +1,2 @@ -GET http://www.redirect0.test/ HTTP/1.1 - +GET http://www.redirect0.test/ HTTP/1.1 + diff --git a/tests/gold_tests/headers/data/www.redirect301.test_get.txt b/tests/gold_tests/headers/data/www.redirect301.test_get.txt index e51c353dddc..48352678c17 100644 --- a/tests/gold_tests/headers/data/www.redirect301.test_get.txt +++ b/tests/gold_tests/headers/data/www.redirect301.test_get.txt @@ -1,2 +1,2 @@ -GET http://www.redirect301.test/ HTTP/1.1 - +GET http://www.redirect301.test/ HTTP/1.1 + diff --git a/tests/gold_tests/headers/data/www.redirect302.test_get.txt b/tests/gold_tests/headers/data/www.redirect302.test_get.txt index 35f77503149..6aae2667c6d 100644 --- a/tests/gold_tests/headers/data/www.redirect302.test_get.txt +++ b/tests/gold_tests/headers/data/www.redirect302.test_get.txt @@ -1,2 +1,2 @@ -GET http://www.redirect302.test/ HTTP/1.1 - +GET http://www.redirect302.test/ HTTP/1.1 + diff --git a/tests/gold_tests/headers/data/www.redirect307.test_get.txt b/tests/gold_tests/headers/data/www.redirect307.test_get.txt index 49bb1bc3072..b37c8ae1486 100644 --- a/tests/gold_tests/headers/data/www.redirect307.test_get.txt +++ b/tests/gold_tests/headers/data/www.redirect307.test_get.txt @@ -1,2 +1,2 @@ -GET http://www.redirect307.test/ HTTP/1.1 - +GET http://www.redirect307.test/ HTTP/1.1 + diff --git a/tests/gold_tests/headers/data/www.redirect308.test_get.txt b/tests/gold_tests/headers/data/www.redirect308.test_get.txt index 097e95eb126..05bcbf8ec78 100644 --- a/tests/gold_tests/headers/data/www.redirect308.test_get.txt +++ b/tests/gold_tests/headers/data/www.redirect308.test_get.txt @@ -1,2 +1,2 @@ -GET http://www.redirect308.test/ HTTP/1.1 - +GET http://www.redirect308.test/ HTTP/1.1 + diff --git a/tests/gold_tests/pluginTest/combo_handler/combo_handler.test.py b/tests/gold_tests/pluginTest/combo_handler/combo_handler.test.py index b4a5a3e2c44..4aeb8b672ee 100644 --- a/tests/gold_tests/pluginTest/combo_handler/combo_handler.test.py +++ b/tests/gold_tests/pluginTest/combo_handler/combo_handler.test.py @@ -117,10 +117,10 @@ def add_server_obj(content_type, path): tr = Test.AddTestRun() tr.Processes.Default.Command = tcp_client("127.0.0.1", ts.Variables.port, - "GET /admin/v1/combo?obj1&sub:obj2&obj3 HTTP/1.1\n" + - "Host: xyz\n" + - "Connection: close\n" + - "\n" + "GET /admin/v1/combo?obj1&sub:obj2&obj3 HTTP/1.1\r\n" + + "Host: xyz\r\n" + + "Connection: close\r\n" + + "\r\n" ) tr.Processes.Default.ReturnCode = 0 f = tr.Disk.File("_output/1-tr-Default/stream.all.txt") @@ -128,10 +128,10 @@ def add_server_obj(content_type, path): tr = Test.AddTestRun() tr.Processes.Default.Command = tcp_client("127.0.0.1", ts.Variables.port, - "GET /admin/v1/combo?obj1&sub:obj2&obj4 HTTP/1.1\n" + - "Host: xyz\n" + - "Connection: close\n" + - "\n" + "GET /admin/v1/combo?obj1&sub:obj2&obj4 HTTP/1.1\r\n" + + "Host: xyz\r\n" + + "Connection: close\r\n" + + "\r\n" ) tr.Processes.Default.ReturnCode = 0 f = tr.Disk.File("_output/2-tr-Default/stream.all.txt") diff --git a/tests/tools/tcp_client.py b/tests/tools/tcp_client.py index 632f76dd4cb..fb9ea827927 100644 --- a/tests/tools/tcp_client.py +++ b/tests/tools/tcp_client.py @@ -63,8 +63,9 @@ def main(argv): args = parser.parse_args() data = '' - with open(args.file, 'r') as f: - data = f.read() + with open(args.file, 'rb') as f: + raw_data = f.read() + data = raw_data.decode() tcp_client(args.host, args.port, data, args.delay_after_send) From 4bbb741f6c65c738852c0f0f18ae26512c5f2b27 Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Mon, 24 May 2021 19:23:30 +0000 Subject: [PATCH 02/12] Fix a few more tests --- tests/gold_tests/tls/early_h1_get.txt | 6 +++--- tests/gold_tests/tls/early_h1_post.txt | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/gold_tests/tls/early_h1_get.txt b/tests/gold_tests/tls/early_h1_get.txt index 93b5876dc30..047f0a308d6 100644 --- a/tests/gold_tests/tls/early_h1_get.txt +++ b/tests/gold_tests/tls/early_h1_get.txt @@ -1,3 +1,3 @@ -GET /early_get HTTP/1.1 -Host: 127.0.0.1 - +GET /early_get HTTP/1.1 +Host: 127.0.0.1 + diff --git a/tests/gold_tests/tls/early_h1_post.txt b/tests/gold_tests/tls/early_h1_post.txt index 117b06c080d..6d7cb5f7d0f 100644 --- a/tests/gold_tests/tls/early_h1_post.txt +++ b/tests/gold_tests/tls/early_h1_post.txt @@ -1,6 +1,6 @@ -POST /early_post HTTP/1.1 -Host: 127.0.0.1 -Content-Length: 11 - +POST /early_post HTTP/1.1 +Host: 127.0.0.1 +Content-Length: 11 + knock knock From 97e49cd6b415a11bf34963a124d3aba1a3892696 Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Tue, 20 Jul 2021 15:07:04 +0000 Subject: [PATCH 03/12] Fix some more test line endings --- .../gold_tests/pluginTest/xdebug/x_cache_info/none.in | 8 ++++---- tests/gold_tests/pluginTest/xdebug/x_cache_info/one.in | 8 ++++---- .../gold_tests/pluginTest/xdebug/x_cache_info/three.in | 8 ++++---- tests/gold_tests/pluginTest/xdebug/x_cache_info/two.in | 8 ++++---- tests/gold_tests/pluginTest/xdebug/x_remap/four.in | 10 +++++----- tests/gold_tests/pluginTest/xdebug/x_remap/fwd1.in | 10 +++++----- tests/gold_tests/pluginTest/xdebug/x_remap/fwd2.in | 10 +++++----- tests/gold_tests/pluginTest/xdebug/x_remap/fwd3.in | 10 +++++----- tests/gold_tests/pluginTest/xdebug/x_remap/fwd4.in | 10 +++++----- tests/gold_tests/pluginTest/xdebug/x_remap/fwd5.in | 10 +++++----- tests/gold_tests/pluginTest/xdebug/x_remap/none.in | 10 +++++----- tests/gold_tests/pluginTest/xdebug/x_remap/one.in | 10 +++++----- tests/gold_tests/pluginTest/xdebug/x_remap/three.in | 10 +++++----- tests/gold_tests/pluginTest/xdebug/x_remap/two.in | 10 +++++----- 14 files changed, 66 insertions(+), 66 deletions(-) diff --git a/tests/gold_tests/pluginTest/xdebug/x_cache_info/none.in b/tests/gold_tests/pluginTest/xdebug/x_cache_info/none.in index 1d9b7f59a4f..2d8e0e1b5b4 100644 --- a/tests/gold_tests/pluginTest/xdebug/x_cache_info/none.in +++ b/tests/gold_tests/pluginTest/xdebug/x_cache_info/none.in @@ -1,4 +1,4 @@ -GET /argh HTTP/1.1 -Host: none -X-Debug: X-Cache-Info - +GET /argh HTTP/1.1 +Host: none +X-Debug: X-Cache-Info + diff --git a/tests/gold_tests/pluginTest/xdebug/x_cache_info/one.in b/tests/gold_tests/pluginTest/xdebug/x_cache_info/one.in index e751d8ddad3..3a73f5fd021 100644 --- a/tests/gold_tests/pluginTest/xdebug/x_cache_info/one.in +++ b/tests/gold_tests/pluginTest/xdebug/x_cache_info/one.in @@ -1,4 +1,4 @@ -GET /argh HTTP/1.1 -Host: one -X-Debug: X-Cache-Info - +GET /argh HTTP/1.1 +Host: one +X-Debug: X-Cache-Info + diff --git a/tests/gold_tests/pluginTest/xdebug/x_cache_info/three.in b/tests/gold_tests/pluginTest/xdebug/x_cache_info/three.in index d0f63c0d440..59ed7b594ac 100644 --- a/tests/gold_tests/pluginTest/xdebug/x_cache_info/three.in +++ b/tests/gold_tests/pluginTest/xdebug/x_cache_info/three.in @@ -1,4 +1,4 @@ -GET /argh HTTP/1.1 -Host: three123 -X-Debug: x-cACHE-iNFO - +GET /argh HTTP/1.1 +Host: three123 +X-Debug: x-cACHE-iNFO + diff --git a/tests/gold_tests/pluginTest/xdebug/x_cache_info/two.in b/tests/gold_tests/pluginTest/xdebug/x_cache_info/two.in index 55786b0aebf..64258cadc38 100644 --- a/tests/gold_tests/pluginTest/xdebug/x_cache_info/two.in +++ b/tests/gold_tests/pluginTest/xdebug/x_cache_info/two.in @@ -1,4 +1,4 @@ -GET /argh HTTP/1.1 -Host: two -X-Debug: x-cache-info - +GET /argh HTTP/1.1 +Host: two +X-Debug: x-cache-info + diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/four.in b/tests/gold_tests/pluginTest/xdebug/x_remap/four.in index 68420397501..481f01534f5 100644 --- a/tests/gold_tests/pluginTest/xdebug/x_remap/four.in +++ b/tests/gold_tests/pluginTest/xdebug/x_remap/four.in @@ -1,5 +1,5 @@ -GET /not_there HTTP/1.1 -Host: two -X-Debug: X-Remap, Probe -Connection: close - +GET /not_there HTTP/1.1 +Host: two +X-Debug: X-Remap, Probe +Connection: close + diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/fwd1.in b/tests/gold_tests/pluginTest/xdebug/x_remap/fwd1.in index 82f3fa52ecb..8b374433c7a 100644 --- a/tests/gold_tests/pluginTest/xdebug/x_remap/fwd1.in +++ b/tests/gold_tests/pluginTest/xdebug/x_remap/fwd1.in @@ -1,5 +1,5 @@ -GET /argh HTTP/1.1 -Host: two -X-Debug: X-Remap, fwd, Probe -Connection: close - +GET /argh HTTP/1.1 +Host: two +X-Debug: X-Remap, fwd, Probe +Connection: close + diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/fwd2.in b/tests/gold_tests/pluginTest/xdebug/x_remap/fwd2.in index 4f7ea91305f..2f6c38ff10e 100644 --- a/tests/gold_tests/pluginTest/xdebug/x_remap/fwd2.in +++ b/tests/gold_tests/pluginTest/xdebug/x_remap/fwd2.in @@ -1,5 +1,5 @@ -GET /argh HTTP/1.1 -Host: two -X-Debug: X-Remap, fwd=0, probe -Connection: close - +GET /argh HTTP/1.1 +Host: two +X-Debug: X-Remap, fwd=0, probe +Connection: close + diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/fwd3.in b/tests/gold_tests/pluginTest/xdebug/x_remap/fwd3.in index 42c187a9c9a..7f30b0f53c7 100644 --- a/tests/gold_tests/pluginTest/xdebug/x_remap/fwd3.in +++ b/tests/gold_tests/pluginTest/xdebug/x_remap/fwd3.in @@ -1,5 +1,5 @@ -GET /argh HTTP/1.1 -Host: two -X-Debug: X-Remap, fwd= 1, Probe -Connection: close - +GET /argh HTTP/1.1 +Host: two +X-Debug: X-Remap, fwd= 1, Probe +Connection: close + diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/fwd4.in b/tests/gold_tests/pluginTest/xdebug/x_remap/fwd4.in index db3ce259716..79699d0dcbe 100644 --- a/tests/gold_tests/pluginTest/xdebug/x_remap/fwd4.in +++ b/tests/gold_tests/pluginTest/xdebug/x_remap/fwd4.in @@ -1,5 +1,5 @@ -GET /argh HTTP/1.1 -Host: two -X-Debug: PROBE, X-Remap, fwd = 999999 -Connection: close - +GET /argh HTTP/1.1 +Host: two +X-Debug: PROBE, X-Remap, fwd = 999999 +Connection: close + diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/fwd5.in b/tests/gold_tests/pluginTest/xdebug/x_remap/fwd5.in index 02b44e7c3de..666e67b2308 100644 --- a/tests/gold_tests/pluginTest/xdebug/x_remap/fwd5.in +++ b/tests/gold_tests/pluginTest/xdebug/x_remap/fwd5.in @@ -1,5 +1,5 @@ -GET /argh HTTP/1.1 -Host: two -X-Debug: X-Remap, fwd = 999999xxx, Probe -Connection: close - +GET /argh HTTP/1.1 +Host: two +X-Debug: X-Remap, fwd = 999999xxx, Probe +Connection: close + diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/none.in b/tests/gold_tests/pluginTest/xdebug/x_remap/none.in index a077b72790d..7b816cefe8e 100644 --- a/tests/gold_tests/pluginTest/xdebug/x_remap/none.in +++ b/tests/gold_tests/pluginTest/xdebug/x_remap/none.in @@ -1,5 +1,5 @@ -GET /argh HTTP/1.1 -Host: none -X-Debug: X-Remap, Probe -Connection: close - +GET /argh HTTP/1.1 +Host: none +X-Debug: X-Remap, Probe +Connection: close + diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/one.in b/tests/gold_tests/pluginTest/xdebug/x_remap/one.in index 6a35a87a16f..f0ae4209ea6 100644 --- a/tests/gold_tests/pluginTest/xdebug/x_remap/one.in +++ b/tests/gold_tests/pluginTest/xdebug/x_remap/one.in @@ -1,5 +1,5 @@ -GET /argh HTTP/1.1 -Host: one -X-Debug: X-Remap, probe -Connection: close - +GET /argh HTTP/1.1 +Host: one +X-Debug: X-Remap, probe +Connection: close + diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/three.in b/tests/gold_tests/pluginTest/xdebug/x_remap/three.in index 1d9612a51f9..8c0269ff946 100644 --- a/tests/gold_tests/pluginTest/xdebug/x_remap/three.in +++ b/tests/gold_tests/pluginTest/xdebug/x_remap/three.in @@ -1,5 +1,5 @@ -GET /argh HTTP/1.1 -Host: three123 -X-Debug: X-Remap, Probe -Connection: close - +GET /argh HTTP/1.1 +Host: three123 +X-Debug: X-Remap, Probe +Connection: close + diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/two.in b/tests/gold_tests/pluginTest/xdebug/x_remap/two.in index 514d173c104..4de650ab71f 100644 --- a/tests/gold_tests/pluginTest/xdebug/x_remap/two.in +++ b/tests/gold_tests/pluginTest/xdebug/x_remap/two.in @@ -1,5 +1,5 @@ -GET /argh HTTP/1.1 -Host: two -X-Debug: PROBE, X-Remap -Connection: close - +GET /argh HTTP/1.1 +Host: two +X-Debug: PROBE, X-Remap +Connection: close + From d67bce92ede5424c0cb2e0ca57d7a1fa965e614d Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Tue, 20 Jul 2021 17:25:54 +0000 Subject: [PATCH 04/12] Fix Unit test and adjust line ending parsing case --- proxy/hdrs/MIME.cc | 23 +++++++++++++++-------- proxy/hdrs/unit_tests/test_Hdrs.cc | 10 +++++----- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/proxy/hdrs/MIME.cc b/proxy/hdrs/MIME.cc index 7a521b57e15..c03f79aea1f 100644 --- a/proxy/hdrs/MIME.cc +++ b/proxy/hdrs/MIME.cc @@ -2382,14 +2382,21 @@ MIMEScanner::get(TextView &input, TextView &output, bool &output_shares_input, b } break; case MIME_PARSE_INSIDE: { - auto lf_off = text.find(ParseRules::CHAR_LF); - if (lf_off != TextView::npos) { - text.remove_prefix(lf_off + 1); // drop up to and including LF - if (LINE == scan_type) { - zret = PARSE_RESULT_OK; - m_state = MIME_PARSE_BEFORE; - } else { - m_state = MIME_PARSE_AFTER; // looking for line folding. + auto cr_off = text.find(ParseRules::CHAR_CR); + if (cr_off != TextView::npos) { + text.remove_prefix(cr_off + 1); // drop up to and including CR + // Is the next item a LF? + auto lf_off = text.find(ParseRules::CHAR_LF); + if (lf_off != TextView::npos) { + text.remove_prefix(lf_off + 1); // drop up to and including LF + if (LINE == scan_type) { + zret = PARSE_RESULT_OK; + m_state = MIME_PARSE_BEFORE; + } else { + m_state = MIME_PARSE_AFTER; // looking for line folding. + } + } else { // No LF yet, adjust state to note + m_state = MIME_PARSE_FOUND_CR; } } else { // no EOL, consume all text without changing state. text.remove_prefix(text.size()); diff --git a/proxy/hdrs/unit_tests/test_Hdrs.cc b/proxy/hdrs/unit_tests/test_Hdrs.cc index 73022bf6212..dc28c2cc9f0 100644 --- a/proxy/hdrs/unit_tests/test_Hdrs.cc +++ b/proxy/hdrs/unit_tests/test_Hdrs.cc @@ -54,15 +54,15 @@ TEST_CASE("HdrTestHttpParse", "[proxy][hdrtest]") {"GET /index.html\r\n", PARSE_RESULT_ERROR, 17}, {"GET /index.html HTTP/1.0", PARSE_RESULT_ERROR, 24}, {"GET /index.html HTTP/1.0\r", PARSE_RESULT_ERROR, 25}, - {"GET /index.html HTTP/1.0\n", PARSE_RESULT_DONE, 25}, - {"GET /index.html HTTP/1.0\n\n", PARSE_RESULT_DONE, 26}, + {"GET /index.html HTTP/1.0\n", PARSE_RESULT_ERROR, 25}, + {"GET /index.html HTTP/1.0\n\n", PARSE_RESULT_ERROR, 26}, {"GET /index.html HTTP/1.0\r\n\r\n", PARSE_RESULT_DONE, 28}, {"GET /index.html HTTP/1.0\r\nUser-Agent: foobar", PARSE_RESULT_ERROR, 44}, - {"GET /index.html HTTP/1.0\r\nUser-Agent: foobar\n", PARSE_RESULT_DONE, 45}, + {"GET /index.html HTTP/1.0\r\nUser-Agent: foobar\n", PARSE_RESULT_ERROR, 45}, {"GET /index.html HTTP/1.0\r\nUser-Agent: foobar\r\n", PARSE_RESULT_DONE, 46}, {"GET /index.html HTTP/1.0\r\nUser-Agent: foobar\r\n\r\n", PARSE_RESULT_DONE, 48}, - {"GET /index.html HTTP/1.0\nUser-Agent: foobar\n", PARSE_RESULT_DONE, 44}, - {"GET /index.html HTTP/1.0\nUser-Agent: foobar\nBoo: foo\n", PARSE_RESULT_DONE, 53}, + {"GET /index.html HTTP/1.0\nUser-Agent: foobar\n", PARSE_RESULT_ERROR, 44}, + {"GET /index.html HTTP/1.0\nUser-Agent: foobar\nBoo: foo\n", PARSE_RESULT_ERROR, 53}, {"GET /index.html HTTP/1.0\r\nUser-Agent: foobar\r\n", PARSE_RESULT_DONE, 46}, {"GET /index.html HTTP/1.0\r\n", PARSE_RESULT_DONE, 26}, {"GET /index.html hTTP/1.0\r\n", PARSE_RESULT_ERROR, 26}, From 30bc058a70d1c8763515cf213b650d358bfa14db Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Tue, 20 Jul 2021 17:35:12 +0000 Subject: [PATCH 05/12] Adjust suffix to avoid trailing whitespace checks in CI --- .../xdebug/x_cache_info/{none.in => none.test_input} | 0 .../pluginTest/xdebug/x_cache_info/{one.in => one.test_input} | 0 .../xdebug/x_cache_info/{three.in => three.test_input} | 0 .../pluginTest/xdebug/x_cache_info/{two.in => two.test_input} | 0 .../pluginTest/xdebug/x_cache_info/x_cache_info.test.py | 4 ++-- .../pluginTest/xdebug/x_remap/{four.in => four.test_input} | 0 .../pluginTest/xdebug/x_remap/{fwd1.in => fwd1.test_input} | 0 .../pluginTest/xdebug/x_remap/{fwd2.in => fwd2.test_input} | 0 .../pluginTest/xdebug/x_remap/{fwd3.in => fwd3.test_input} | 0 .../pluginTest/xdebug/x_remap/{fwd4.in => fwd4.test_input} | 0 .../pluginTest/xdebug/x_remap/{fwd5.in => fwd5.test_input} | 0 .../pluginTest/xdebug/x_remap/{none.in => none.test_input} | 0 .../pluginTest/xdebug/x_remap/{one.in => one.test_input} | 0 .../pluginTest/xdebug/x_remap/{three.in => three.test_input} | 0 .../pluginTest/xdebug/x_remap/{two.in => two.test_input} | 0 tests/gold_tests/pluginTest/xdebug/x_remap/x_remap.test.py | 2 +- 16 files changed, 3 insertions(+), 3 deletions(-) rename tests/gold_tests/pluginTest/xdebug/x_cache_info/{none.in => none.test_input} (100%) rename tests/gold_tests/pluginTest/xdebug/x_cache_info/{one.in => one.test_input} (100%) rename tests/gold_tests/pluginTest/xdebug/x_cache_info/{three.in => three.test_input} (100%) rename tests/gold_tests/pluginTest/xdebug/x_cache_info/{two.in => two.test_input} (100%) rename tests/gold_tests/pluginTest/xdebug/x_remap/{four.in => four.test_input} (100%) rename tests/gold_tests/pluginTest/xdebug/x_remap/{fwd1.in => fwd1.test_input} (100%) rename tests/gold_tests/pluginTest/xdebug/x_remap/{fwd2.in => fwd2.test_input} (100%) rename tests/gold_tests/pluginTest/xdebug/x_remap/{fwd3.in => fwd3.test_input} (100%) rename tests/gold_tests/pluginTest/xdebug/x_remap/{fwd4.in => fwd4.test_input} (100%) rename tests/gold_tests/pluginTest/xdebug/x_remap/{fwd5.in => fwd5.test_input} (100%) rename tests/gold_tests/pluginTest/xdebug/x_remap/{none.in => none.test_input} (100%) rename tests/gold_tests/pluginTest/xdebug/x_remap/{one.in => one.test_input} (100%) rename tests/gold_tests/pluginTest/xdebug/x_remap/{three.in => three.test_input} (100%) rename tests/gold_tests/pluginTest/xdebug/x_remap/{two.in => two.test_input} (100%) diff --git a/tests/gold_tests/pluginTest/xdebug/x_cache_info/none.in b/tests/gold_tests/pluginTest/xdebug/x_cache_info/none.test_input similarity index 100% rename from tests/gold_tests/pluginTest/xdebug/x_cache_info/none.in rename to tests/gold_tests/pluginTest/xdebug/x_cache_info/none.test_input diff --git a/tests/gold_tests/pluginTest/xdebug/x_cache_info/one.in b/tests/gold_tests/pluginTest/xdebug/x_cache_info/one.test_input similarity index 100% rename from tests/gold_tests/pluginTest/xdebug/x_cache_info/one.in rename to tests/gold_tests/pluginTest/xdebug/x_cache_info/one.test_input diff --git a/tests/gold_tests/pluginTest/xdebug/x_cache_info/three.in b/tests/gold_tests/pluginTest/xdebug/x_cache_info/three.test_input similarity index 100% rename from tests/gold_tests/pluginTest/xdebug/x_cache_info/three.in rename to tests/gold_tests/pluginTest/xdebug/x_cache_info/three.test_input diff --git a/tests/gold_tests/pluginTest/xdebug/x_cache_info/two.in b/tests/gold_tests/pluginTest/xdebug/x_cache_info/two.test_input similarity index 100% rename from tests/gold_tests/pluginTest/xdebug/x_cache_info/two.in rename to tests/gold_tests/pluginTest/xdebug/x_cache_info/two.test_input diff --git a/tests/gold_tests/pluginTest/xdebug/x_cache_info/x_cache_info.test.py b/tests/gold_tests/pluginTest/xdebug/x_cache_info/x_cache_info.test.py index 892297bb6dd..39a861e65a7 100644 --- a/tests/gold_tests/pluginTest/xdebug/x_cache_info/x_cache_info.test.py +++ b/tests/gold_tests/pluginTest/xdebug/x_cache_info/x_cache_info.test.py @@ -51,13 +51,13 @@ files = ["none", "one", "two", "three"] for file in files: - Test.Setup.Copy(f'{Test.TestDirectory}/{file}.in') + Test.Setup.Copy(f'{Test.TestDirectory}/{file}.test_input') def sendMsg(msgFile): global started tr = Test.AddTestRun() - tr.Processes.Default.Command = f"( python3 tools/tcp_client.py 127.0.0.1 {ts.Variables.port} {msgFile}.in ; echo '======' ) | sed 's/:{server.Variables.Port}/:SERVER_PORT/' >> out.log 2>&1" + tr.Processes.Default.Command = f"( python3 tools/tcp_client.py 127.0.0.1 {ts.Variables.port} {msgFile}.test_input ; echo '======' ) | sed 's/:{server.Variables.Port}/:SERVER_PORT/' >> out.log 2>&1" tr.Processes.Default.ReturnCode = 0 if not started: diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/four.in b/tests/gold_tests/pluginTest/xdebug/x_remap/four.test_input similarity index 100% rename from tests/gold_tests/pluginTest/xdebug/x_remap/four.in rename to tests/gold_tests/pluginTest/xdebug/x_remap/four.test_input diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/fwd1.in b/tests/gold_tests/pluginTest/xdebug/x_remap/fwd1.test_input similarity index 100% rename from tests/gold_tests/pluginTest/xdebug/x_remap/fwd1.in rename to tests/gold_tests/pluginTest/xdebug/x_remap/fwd1.test_input diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/fwd2.in b/tests/gold_tests/pluginTest/xdebug/x_remap/fwd2.test_input similarity index 100% rename from tests/gold_tests/pluginTest/xdebug/x_remap/fwd2.in rename to tests/gold_tests/pluginTest/xdebug/x_remap/fwd2.test_input diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/fwd3.in b/tests/gold_tests/pluginTest/xdebug/x_remap/fwd3.test_input similarity index 100% rename from tests/gold_tests/pluginTest/xdebug/x_remap/fwd3.in rename to tests/gold_tests/pluginTest/xdebug/x_remap/fwd3.test_input diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/fwd4.in b/tests/gold_tests/pluginTest/xdebug/x_remap/fwd4.test_input similarity index 100% rename from tests/gold_tests/pluginTest/xdebug/x_remap/fwd4.in rename to tests/gold_tests/pluginTest/xdebug/x_remap/fwd4.test_input diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/fwd5.in b/tests/gold_tests/pluginTest/xdebug/x_remap/fwd5.test_input similarity index 100% rename from tests/gold_tests/pluginTest/xdebug/x_remap/fwd5.in rename to tests/gold_tests/pluginTest/xdebug/x_remap/fwd5.test_input diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/none.in b/tests/gold_tests/pluginTest/xdebug/x_remap/none.test_input similarity index 100% rename from tests/gold_tests/pluginTest/xdebug/x_remap/none.in rename to tests/gold_tests/pluginTest/xdebug/x_remap/none.test_input diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/one.in b/tests/gold_tests/pluginTest/xdebug/x_remap/one.test_input similarity index 100% rename from tests/gold_tests/pluginTest/xdebug/x_remap/one.in rename to tests/gold_tests/pluginTest/xdebug/x_remap/one.test_input diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/three.in b/tests/gold_tests/pluginTest/xdebug/x_remap/three.test_input similarity index 100% rename from tests/gold_tests/pluginTest/xdebug/x_remap/three.in rename to tests/gold_tests/pluginTest/xdebug/x_remap/three.test_input diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/two.in b/tests/gold_tests/pluginTest/xdebug/x_remap/two.test_input similarity index 100% rename from tests/gold_tests/pluginTest/xdebug/x_remap/two.in rename to tests/gold_tests/pluginTest/xdebug/x_remap/two.test_input diff --git a/tests/gold_tests/pluginTest/xdebug/x_remap/x_remap.test.py b/tests/gold_tests/pluginTest/xdebug/x_remap/x_remap.test.py index f5ee5df0eea..d85dedcef81 100644 --- a/tests/gold_tests/pluginTest/xdebug/x_remap/x_remap.test.py +++ b/tests/gold_tests/pluginTest/xdebug/x_remap/x_remap.test.py @@ -59,7 +59,7 @@ def sendMsg(msgFile): tr = Test.AddTestRun() tr.Processes.Default.Command = ( - "( python3 {}/tcp_client.py 127.0.0.1 {} {}/{}.in".format( + "( python3 {}/tcp_client.py 127.0.0.1 {} {}/{}.test_input".format( Test.RunDirectory, ts.Variables.port, Test.TestDirectory, msgFile) + " ; echo '======' ) | sed 's/:{}/:SERVER_PORT/' >> {}/out.log 2>&1 ".format( server.Variables.Port, Test.RunDirectory) From 6a9e21161525c547b8bd3381655e400cbd58c34e Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Tue, 20 Jul 2021 18:12:03 +0000 Subject: [PATCH 06/12] Rename more files --- ...t.txt => www.customplugin204.test_get.test_input} | 0 ...txt => www.customtemplate204.test_get.test_input} | 0 ...st_get.txt => www.default204.test_get.test_input} | 0 ...st_get.txt => www.default304.test_get.test_input} | 0 ...t_200.txt => www.example.test_get_200.test_input} | 0 ...t_304.txt => www.example.test_get_304.test_input} | 0 ...est_head.txt => www.example.test_head.test_input} | 0 ..._200.txt => www.example.test_head_200.test_input} | 0 .../gold_tests/body_factory/http204_response.test.py | 4 ++-- .../body_factory/http204_response_plugin.test.py | 2 +- .../gold_tests/body_factory/http304_response.test.py | 2 +- .../body_factory/http_head_no_origin.test.py | 2 +- .../gold_tests/body_factory/http_with_origin.test.py | 6 +++--- ....http408.test.txt => www.http408.test.test_input} | 0 ...t_get.txt => www.passthrough.test_get.test_input} | 0 ...est_get.txt => www.redirect0.test_get.test_input} | 0 ...t_get.txt => www.redirect301.test_get.test_input} | 0 ...t_get.txt => www.redirect302.test_get.test_input} | 0 ...t_get.txt => www.redirect307.test_get.test_input} | 0 ...t_get.txt => www.redirect308.test_get.test_input} | 0 .../gold_tests/headers/domain-blacklist-30x.test.py | 12 ++++++------ tests/gold_tests/headers/http408.test.py | 2 +- 22 files changed, 15 insertions(+), 15 deletions(-) rename tests/gold_tests/body_factory/data/{www.customplugin204.test_get.txt => www.customplugin204.test_get.test_input} (100%) rename tests/gold_tests/body_factory/data/{www.customtemplate204.test_get.txt => www.customtemplate204.test_get.test_input} (100%) rename tests/gold_tests/body_factory/data/{www.default204.test_get.txt => www.default204.test_get.test_input} (100%) rename tests/gold_tests/body_factory/data/{www.default304.test_get.txt => www.default304.test_get.test_input} (100%) rename tests/gold_tests/body_factory/data/{www.example.test_get_200.txt => www.example.test_get_200.test_input} (100%) rename tests/gold_tests/body_factory/data/{www.example.test_get_304.txt => www.example.test_get_304.test_input} (100%) rename tests/gold_tests/body_factory/data/{www.example.test_head.txt => www.example.test_head.test_input} (100%) rename tests/gold_tests/body_factory/data/{www.example.test_head_200.txt => www.example.test_head_200.test_input} (100%) rename tests/gold_tests/headers/data/{www.http408.test.txt => www.http408.test.test_input} (100%) rename tests/gold_tests/headers/data/{www.passthrough.test_get.txt => www.passthrough.test_get.test_input} (100%) rename tests/gold_tests/headers/data/{www.redirect0.test_get.txt => www.redirect0.test_get.test_input} (100%) rename tests/gold_tests/headers/data/{www.redirect301.test_get.txt => www.redirect301.test_get.test_input} (100%) rename tests/gold_tests/headers/data/{www.redirect302.test_get.txt => www.redirect302.test_get.test_input} (100%) rename tests/gold_tests/headers/data/{www.redirect307.test_get.txt => www.redirect307.test_get.test_input} (100%) rename tests/gold_tests/headers/data/{www.redirect308.test_get.txt => www.redirect308.test_get.test_input} (100%) diff --git a/tests/gold_tests/body_factory/data/www.customplugin204.test_get.txt b/tests/gold_tests/body_factory/data/www.customplugin204.test_get.test_input similarity index 100% rename from tests/gold_tests/body_factory/data/www.customplugin204.test_get.txt rename to tests/gold_tests/body_factory/data/www.customplugin204.test_get.test_input diff --git a/tests/gold_tests/body_factory/data/www.customtemplate204.test_get.txt b/tests/gold_tests/body_factory/data/www.customtemplate204.test_get.test_input similarity index 100% rename from tests/gold_tests/body_factory/data/www.customtemplate204.test_get.txt rename to tests/gold_tests/body_factory/data/www.customtemplate204.test_get.test_input diff --git a/tests/gold_tests/body_factory/data/www.default204.test_get.txt b/tests/gold_tests/body_factory/data/www.default204.test_get.test_input similarity index 100% rename from tests/gold_tests/body_factory/data/www.default204.test_get.txt rename to tests/gold_tests/body_factory/data/www.default204.test_get.test_input diff --git a/tests/gold_tests/body_factory/data/www.default304.test_get.txt b/tests/gold_tests/body_factory/data/www.default304.test_get.test_input similarity index 100% rename from tests/gold_tests/body_factory/data/www.default304.test_get.txt rename to tests/gold_tests/body_factory/data/www.default304.test_get.test_input diff --git a/tests/gold_tests/body_factory/data/www.example.test_get_200.txt b/tests/gold_tests/body_factory/data/www.example.test_get_200.test_input similarity index 100% rename from tests/gold_tests/body_factory/data/www.example.test_get_200.txt rename to tests/gold_tests/body_factory/data/www.example.test_get_200.test_input diff --git a/tests/gold_tests/body_factory/data/www.example.test_get_304.txt b/tests/gold_tests/body_factory/data/www.example.test_get_304.test_input similarity index 100% rename from tests/gold_tests/body_factory/data/www.example.test_get_304.txt rename to tests/gold_tests/body_factory/data/www.example.test_get_304.test_input diff --git a/tests/gold_tests/body_factory/data/www.example.test_head.txt b/tests/gold_tests/body_factory/data/www.example.test_head.test_input similarity index 100% rename from tests/gold_tests/body_factory/data/www.example.test_head.txt rename to tests/gold_tests/body_factory/data/www.example.test_head.test_input diff --git a/tests/gold_tests/body_factory/data/www.example.test_head_200.txt b/tests/gold_tests/body_factory/data/www.example.test_head_200.test_input similarity index 100% rename from tests/gold_tests/body_factory/data/www.example.test_head_200.txt rename to tests/gold_tests/body_factory/data/www.example.test_head_200.test_input diff --git a/tests/gold_tests/body_factory/http204_response.test.py b/tests/gold_tests/body_factory/http204_response.test.py index 5d1147e9561..529abf6266a 100644 --- a/tests/gold_tests/body_factory/http204_response.test.py +++ b/tests/gold_tests/body_factory/http204_response.test.py @@ -77,7 +77,7 @@ defaultTr.Processes.Default.StartBefore(Test.Processes.ts) defaultTr.StillRunningAfter = ts -defaultTr.Processes.Default.Command = f"{sys.executable} tcp_client.py 127.0.0.1 {ts.Variables.port} data/{DEFAULT_204_HOST}_get.txt" +defaultTr.Processes.Default.Command = f"{sys.executable} tcp_client.py 127.0.0.1 {ts.Variables.port} data/{DEFAULT_204_HOST}_get.test_input" defaultTr.Processes.Default.TimeOut = 5 # seconds defaultTr.Processes.Default.ReturnCode = 0 defaultTr.Processes.Default.Streams.stdout = "gold/http-204.gold" @@ -86,7 +86,7 @@ customTemplateTr = Test.AddTestRun(f"Test domain {CUSTOM_TEMPLATE_204_HOST}") customTemplateTr.StillRunningBefore = ts customTemplateTr.StillRunningAfter = ts -customTemplateTr.Processes.Default.Command = f"{sys.executable} tcp_client.py 127.0.0.1 {ts.Variables.port} data/{CUSTOM_TEMPLATE_204_HOST}_get.txt" +customTemplateTr.Processes.Default.Command = f"{sys.executable} tcp_client.py 127.0.0.1 {ts.Variables.port} data/{CUSTOM_TEMPLATE_204_HOST}_get.test_input" customTemplateTr.Processes.Default.TimeOut = 5 # seconds customTemplateTr.Processes.Default.ReturnCode = 0 customTemplateTr.Processes.Default.Streams.stdout = "gold/http-204-custom.gold" diff --git a/tests/gold_tests/body_factory/http204_response_plugin.test.py b/tests/gold_tests/body_factory/http204_response_plugin.test.py index 72ba642c908..7f701961654 100644 --- a/tests/gold_tests/body_factory/http204_response_plugin.test.py +++ b/tests/gold_tests/body_factory/http204_response_plugin.test.py @@ -45,7 +45,7 @@ tr.Processes.Default.StartBefore(Test.Processes.ts) tr.StillRunningAfter = ts -tr.Processes.Default.Command = f"{sys.executable} tcp_client.py 127.0.0.1 {ts.Variables.port} data/{CUSTOM_PLUGIN_204_HOST}_get.txt" +tr.Processes.Default.Command = f"{sys.executable} tcp_client.py 127.0.0.1 {ts.Variables.port} data/{CUSTOM_PLUGIN_204_HOST}_get.test_input" tr.Processes.Default.TimeOut = 5 # seconds tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/http-204-custom-plugin.gold" diff --git a/tests/gold_tests/body_factory/http304_response.test.py b/tests/gold_tests/body_factory/http304_response.test.py index 7baa4b424e2..807f413d28f 100644 --- a/tests/gold_tests/body_factory/http304_response.test.py +++ b/tests/gold_tests/body_factory/http304_response.test.py @@ -48,7 +48,7 @@ tr.Processes.Default.StartBefore(Test.Processes.ts) tr.StillRunningAfter = ts -cmd_tpl = f"{sys.executable} tcp_client.py 127.0.0.1 {ts.Variables.port} data/{DEFAULT_304_HOST}_get.txt" +cmd_tpl = f"{sys.executable} tcp_client.py 127.0.0.1 {ts.Variables.port} data/{DEFAULT_304_HOST}_get.test_input" tr.Processes.Default.Command = cmd_tpl tr.Processes.Default.TimeOut = 5 # seconds tr.Processes.Default.ReturnCode = 0 diff --git a/tests/gold_tests/body_factory/http_head_no_origin.test.py b/tests/gold_tests/body_factory/http_head_no_origin.test.py index 097c4761095..2e1c4a2a35b 100644 --- a/tests/gold_tests/body_factory/http_head_no_origin.test.py +++ b/tests/gold_tests/body_factory/http_head_no_origin.test.py @@ -37,7 +37,7 @@ tr.Processes.Default.StartBefore(Test.Processes.ts) tr.StillRunningAfter = ts -tr.Processes.Default.Command = f"{sys.executable} tcp_client.py 127.0.0.1 {ts.Variables.port} data/{HOST}_head.txt" +tr.Processes.Default.Command = f"{sys.executable} tcp_client.py 127.0.0.1 {ts.Variables.port} data/{HOST}_head.test_input" tr.Processes.Default.TimeOut = 5 # seconds tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Streams.stdout = "gold/http-head-no-origin.gold" diff --git a/tests/gold_tests/body_factory/http_with_origin.test.py b/tests/gold_tests/body_factory/http_with_origin.test.py index 24f833e03f4..8ea3c0a7954 100644 --- a/tests/gold_tests/body_factory/http_with_origin.test.py +++ b/tests/gold_tests/body_factory/http_with_origin.test.py @@ -74,7 +74,7 @@ trhead200.StillRunningAfter = ts trhead200.StillRunningAfter = server -trhead200.Processes.Default.Command = f"{sys.executable} tcp_client.py 127.0.0.1 {ts.Variables.port} data/{HOST}_head_200.txt" +trhead200.Processes.Default.Command = f"{sys.executable} tcp_client.py 127.0.0.1 {ts.Variables.port} data/{HOST}_head_200.test_input" trhead200.Processes.Default.TimeOut = 5 # seconds trhead200.Processes.Default.ReturnCode = 0 trhead200.Processes.Default.Streams.stdout = "gold/http-head-200.gold" @@ -86,7 +86,7 @@ trget200.StillRunningAfter = ts trget200.StillRunningAfter = server -trget200.Processes.Default.Command = f"{sys.executable} tcp_client.py 127.0.0.1 {ts.Variables.port} data/{HOST}_get_200.txt" +trget200.Processes.Default.Command = f"{sys.executable} tcp_client.py 127.0.0.1 {ts.Variables.port} data/{HOST}_get_200.test_input" trget200.Processes.Default.TimeOut = 5 # seconds trget200.Processes.Default.ReturnCode = 0 trget200.Processes.Default.Streams.stdout = "gold/http-get-200.gold" @@ -98,7 +98,7 @@ trget304.StillRunningAfter = ts trget304.StillRunningAfter = server -cmd_tpl = f"{sys.executable} tcp_client.py 127.0.0.1 {ts.Variables.port} data/{HOST}_get_304.txt" +cmd_tpl = f"{sys.executable} tcp_client.py 127.0.0.1 {ts.Variables.port} data/{HOST}_get_304.test_input" trget304.Processes.Default.Command = cmd_tpl trget304.Processes.Default.TimeOut = 5 # seconds trget304.Processes.Default.ReturnCode = 0 diff --git a/tests/gold_tests/headers/data/www.http408.test.txt b/tests/gold_tests/headers/data/www.http408.test.test_input similarity index 100% rename from tests/gold_tests/headers/data/www.http408.test.txt rename to tests/gold_tests/headers/data/www.http408.test.test_input diff --git a/tests/gold_tests/headers/data/www.passthrough.test_get.txt b/tests/gold_tests/headers/data/www.passthrough.test_get.test_input similarity index 100% rename from tests/gold_tests/headers/data/www.passthrough.test_get.txt rename to tests/gold_tests/headers/data/www.passthrough.test_get.test_input diff --git a/tests/gold_tests/headers/data/www.redirect0.test_get.txt b/tests/gold_tests/headers/data/www.redirect0.test_get.test_input similarity index 100% rename from tests/gold_tests/headers/data/www.redirect0.test_get.txt rename to tests/gold_tests/headers/data/www.redirect0.test_get.test_input diff --git a/tests/gold_tests/headers/data/www.redirect301.test_get.txt b/tests/gold_tests/headers/data/www.redirect301.test_get.test_input similarity index 100% rename from tests/gold_tests/headers/data/www.redirect301.test_get.txt rename to tests/gold_tests/headers/data/www.redirect301.test_get.test_input diff --git a/tests/gold_tests/headers/data/www.redirect302.test_get.txt b/tests/gold_tests/headers/data/www.redirect302.test_get.test_input similarity index 100% rename from tests/gold_tests/headers/data/www.redirect302.test_get.txt rename to tests/gold_tests/headers/data/www.redirect302.test_get.test_input diff --git a/tests/gold_tests/headers/data/www.redirect307.test_get.txt b/tests/gold_tests/headers/data/www.redirect307.test_get.test_input similarity index 100% rename from tests/gold_tests/headers/data/www.redirect307.test_get.txt rename to tests/gold_tests/headers/data/www.redirect307.test_get.test_input diff --git a/tests/gold_tests/headers/data/www.redirect308.test_get.txt b/tests/gold_tests/headers/data/www.redirect308.test_get.test_input similarity index 100% rename from tests/gold_tests/headers/data/www.redirect308.test_get.txt rename to tests/gold_tests/headers/data/www.redirect308.test_get.test_input diff --git a/tests/gold_tests/headers/domain-blacklist-30x.test.py b/tests/gold_tests/headers/domain-blacklist-30x.test.py index 275c3425890..b38f1413c55 100644 --- a/tests/gold_tests/headers/domain-blacklist-30x.test.py +++ b/tests/gold_tests/headers/domain-blacklist-30x.test.py @@ -60,7 +60,7 @@ redirect301tr.Processes.Default.StartBefore(Test.Processes.ts) redirect301tr.StillRunningAfter = ts redirect301tr.Processes.Default.Command = "python3 tcp_client.py 127.0.0.1 {0} {1} | grep -v '^Date: '| grep -v '^Server: ATS/'".\ - format(ts.Variables.port, 'data/{0}_get.txt'.format(REDIRECT_301_HOST)) + format(ts.Variables.port, 'data/{0}_get.test_input'.format(REDIRECT_301_HOST)) redirect301tr.Processes.Default.TimeOut = 5 # seconds redirect301tr.Processes.Default.ReturnCode = 0 redirect301tr.Processes.Default.Streams.stdout = "redirect301_get.gold" @@ -69,7 +69,7 @@ redirect302tr.StillRunningBefore = ts redirect302tr.StillRunningAfter = ts redirect302tr.Processes.Default.Command = "python3 tcp_client.py 127.0.0.1 {0} {1} | grep -v '^Date: '| grep -v '^Server: ATS/'".\ - format(ts.Variables.port, 'data/{0}_get.txt'.format(REDIRECT_302_HOST)) + format(ts.Variables.port, 'data/{0}_get.test_input'.format(REDIRECT_302_HOST)) redirect302tr.Processes.Default.TimeOut = 5 # seconds redirect302tr.Processes.Default.ReturnCode = 0 redirect302tr.Processes.Default.Streams.stdout = "redirect302_get.gold" @@ -79,7 +79,7 @@ redirect302tr.StillRunningBefore = ts redirect307tr.StillRunningAfter = ts redirect307tr.Processes.Default.Command = "python3 tcp_client.py 127.0.0.1 {0} {1} | grep -v '^Date: '| grep -v '^Server: ATS/'".\ - format(ts.Variables.port, 'data/{0}_get.txt'.format(REDIRECT_307_HOST)) + format(ts.Variables.port, 'data/{0}_get.test_input'.format(REDIRECT_307_HOST)) redirect307tr.Processes.Default.TimeOut = 5 # seconds redirect307tr.Processes.Default.ReturnCode = 0 redirect307tr.Processes.Default.Streams.stdout = "redirect307_get.gold" @@ -88,7 +88,7 @@ redirect308tr.StillRunningBefore = ts redirect308tr.StillRunningAfter = ts redirect308tr.Processes.Default.Command = "python3 tcp_client.py 127.0.0.1 {0} {1} | grep -v '^Date: '| grep -v '^Server: ATS/'".\ - format(ts.Variables.port, 'data/{0}_get.txt'.format(REDIRECT_308_HOST)) + format(ts.Variables.port, 'data/{0}_get.test_input'.format(REDIRECT_308_HOST)) redirect308tr.Processes.Default.TimeOut = 5 # seconds redirect308tr.Processes.Default.ReturnCode = 0 redirect308tr.Processes.Default.Streams.stdout = "redirect308_get.gold" @@ -97,7 +97,7 @@ redirect0tr.StillRunningBefore = ts redirect0tr.StillRunningAfter = ts redirect0tr.Processes.Default.Command = "python3 tcp_client.py 127.0.0.1 {0} {1} | grep -v '^Date: '| grep -v '^Server: ATS/'".\ - format(ts.Variables.port, 'data/{0}_get.txt'.format(REDIRECT_0_HOST)) + format(ts.Variables.port, 'data/{0}_get.test_input'.format(REDIRECT_0_HOST)) redirect0tr.Processes.Default.TimeOut = 5 # seconds redirect0tr.Processes.Default.ReturnCode = 0 redirect0tr.Processes.Default.Streams.stdout = "redirect0_get.gold" @@ -106,7 +106,7 @@ passthroughtr.StillRunningBefore = ts passthroughtr.StillRunningAfter = ts passthroughtr.Processes.Default.Command = "python3 tcp_client.py 127.0.0.1 {0} {1} | grep -v '^Date: '| grep -v '^Server: ATS/'".\ - format(ts.Variables.port, 'data/{0}_get.txt'.format(PASSTHRU_HOST)) + format(ts.Variables.port, 'data/{0}_get.test_input'.format(PASSTHRU_HOST)) passthroughtr.Processes.Default.TimeOut = 5 # seconds passthroughtr.Processes.Default.ReturnCode = 0 passthroughtr.Processes.Default.Streams.stdout = "passthrough_get.gold" diff --git a/tests/gold_tests/headers/http408.test.py b/tests/gold_tests/headers/http408.test.py index e3c2d9cd697..8f6b5d21f4b 100644 --- a/tests/gold_tests/headers/http408.test.py +++ b/tests/gold_tests/headers/http408.test.py @@ -51,7 +51,7 @@ tr.Processes.Default.StartBefore(server) tr.Processes.Default.StartBefore(Test.Processes.ts) tr.Processes.Default.Command = 'python3 tcp_client.py 127.0.0.1 {0} {1} --delay-after-send {2}'\ - .format(ts.Variables.port, 'data/{0}.txt'.format(HTTP_408_HOST), TIMEOUT + 2) + .format(ts.Variables.port, 'data/{0}.test_input'.format(HTTP_408_HOST), TIMEOUT + 2) tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.TimeOut = 10 tr.Processes.Default.Streams.stdout = "http408.gold" From 6f4aa57d85eccf6c8d76c104ab037c25f2b43850 Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Tue, 20 Jul 2021 18:16:18 +0000 Subject: [PATCH 07/12] Rename two more input files --- .../tls/{early_h1_get.txt => early_h1_get.test_input} | 0 .../tls/{early_h1_post.txt => early_h1_post.test_input} | 0 tests/gold_tests/tls/tls_0rtt_server.test.py | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename tests/gold_tests/tls/{early_h1_get.txt => early_h1_get.test_input} (100%) rename tests/gold_tests/tls/{early_h1_post.txt => early_h1_post.test_input} (100%) diff --git a/tests/gold_tests/tls/early_h1_get.txt b/tests/gold_tests/tls/early_h1_get.test_input similarity index 100% rename from tests/gold_tests/tls/early_h1_get.txt rename to tests/gold_tests/tls/early_h1_get.test_input diff --git a/tests/gold_tests/tls/early_h1_post.txt b/tests/gold_tests/tls/early_h1_post.test_input similarity index 100% rename from tests/gold_tests/tls/early_h1_post.txt rename to tests/gold_tests/tls/early_h1_post.test_input diff --git a/tests/gold_tests/tls/tls_0rtt_server.test.py b/tests/gold_tests/tls/tls_0rtt_server.test.py index 2c69ec087f2..039b953457c 100644 --- a/tests/gold_tests/tls/tls_0rtt_server.test.py +++ b/tests/gold_tests/tls/tls_0rtt_server.test.py @@ -100,8 +100,8 @@ ts.Setup.Copy('test-0rtt-s_client.py') ts.Setup.Copy('h2_early_decode.py') -ts.Setup.Copy('early_h1_get.txt') -ts.Setup.Copy('early_h1_post.txt') +ts.Setup.Copy('early_h1_get.test_input') +ts.Setup.Copy('early_h1_post.test_input') ts.Setup.Copy('early_h2_get.txt') ts.Setup.Copy('early_h2_post.txt') ts.Setup.Copy('early_h2_multi1.txt') From 4282db95170d482b5ad39345da45086deb4447d6 Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Tue, 20 Jul 2021 18:44:02 +0000 Subject: [PATCH 08/12] Update rat exception list --- ci/rat-regex.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ci/rat-regex.txt b/ci/rat-regex.txt index 26c63b9523d..5cdff4d02fc 100644 --- a/ci/rat-regex.txt +++ b/ci/rat-regex.txt @@ -24,6 +24,7 @@ .*\.config$ .*\.yaml$ .*\.gold$ +.*\.test_input$ ^\.gitignore$ ^\.gitmodules$ ^\.perltidyrc$ @@ -65,6 +66,4 @@ port\.h ^protocol_binary.h$ ^override.css$ ^catch[.]hpp$ -^configuru.hpp$ ^yamlcpp$ -^tests/gold_tests/autest-site/min_cfg$ From d4ab1d4c72ae3e7093a9b1c6acc57a5b6d2dba94 Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Tue, 20 Jul 2021 18:55:47 +0000 Subject: [PATCH 09/12] Trying to fix the RAT exception again --- ci/rat-regex.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/rat-regex.txt b/ci/rat-regex.txt index 5cdff4d02fc..dfea60e7f59 100644 --- a/ci/rat-regex.txt +++ b/ci/rat-regex.txt @@ -66,4 +66,6 @@ port\.h ^protocol_binary.h$ ^override.css$ ^catch[.]hpp$ +^configuru.hpp$ ^yamlcpp$ +^tests/gold_tests/autest-site/min_cfg$ From c2d70e5650037468cad2a4a69479a45e91efc81d Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Fri, 6 Aug 2021 21:41:51 +0000 Subject: [PATCH 10/12] Some more cr/lf parsing fixes --- proxy/hdrs/MIME.cc | 29 ++++++++++++++--------------- proxy/hdrs/unit_tests/test_Hdrs.cc | 4 +++- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/proxy/hdrs/MIME.cc b/proxy/hdrs/MIME.cc index c03f79aea1f..7376e3ca870 100644 --- a/proxy/hdrs/MIME.cc +++ b/proxy/hdrs/MIME.cc @@ -2386,14 +2386,17 @@ MIMEScanner::get(TextView &input, TextView &output, bool &output_shares_input, b if (cr_off != TextView::npos) { text.remove_prefix(cr_off + 1); // drop up to and including CR // Is the next item a LF? - auto lf_off = text.find(ParseRules::CHAR_LF); - if (lf_off != TextView::npos) { - text.remove_prefix(lf_off + 1); // drop up to and including LF - if (LINE == scan_type) { - zret = PARSE_RESULT_OK; - m_state = MIME_PARSE_BEFORE; - } else { - m_state = MIME_PARSE_AFTER; // looking for line folding. + if (!text.empty()) { + if (text[0] == ParseRules::CHAR_LF) { + text.remove_prefix(1); // drop up to and including LF + if (LINE == scan_type) { + zret = PARSE_RESULT_OK; + m_state = MIME_PARSE_BEFORE; + } else { + m_state = MIME_PARSE_AFTER; // looking for line folding. + } + } else { // Next char is not LF, you lose + zret = PARSE_RESULT_ERROR; } } else { // No LF yet, adjust state to note m_state = MIME_PARSE_FOUND_CR; @@ -2533,18 +2536,14 @@ mime_parser_parse(MIMEParser *parser, HdrHeap *heap, MIMEHdrImpl *mh, const char return err; } - ////////////////////////////////////////////////// - // if got a LF or CR on its own, end the header // - ////////////////////////////////////////////////// + /////////////////////////////////////////////////// + // if got a CR and LF on its own, end the header // + /////////////////////////////////////////////////// if ((parsed.size() >= 2) && (parsed[0] == ParseRules::CHAR_CR) && (parsed[1] == ParseRules::CHAR_LF)) { return PARSE_RESULT_DONE; } - if ((parsed.size() >= 1) && (parsed[0] == ParseRules::CHAR_LF)) { - return PARSE_RESULT_DONE; - } - ///////////////////////////////////////////// // find pointers into the name:value field // ///////////////////////////////////////////// diff --git a/proxy/hdrs/unit_tests/test_Hdrs.cc b/proxy/hdrs/unit_tests/test_Hdrs.cc index dc28c2cc9f0..51827b00407 100644 --- a/proxy/hdrs/unit_tests/test_Hdrs.cc +++ b/proxy/hdrs/unit_tests/test_Hdrs.cc @@ -45,9 +45,11 @@ TEST_CASE("HdrTestHttpParse", "[proxy][hdrtest]") int expected_result; int expected_bytes_consumed; }; - static const std::array tests = {{ + static const std::array tests = {{ {"GET /index.html HTTP/1.0\r\n", PARSE_RESULT_DONE, 26}, {"GET /index.html HTTP/1.0\r\n\r\n***BODY****", PARSE_RESULT_DONE, 28}, + {"GET /index.html HTTP/1.0\r\na\rb\n", PARSE_RESULT_ERROR, 28}, + {"GET /index.html HTTP/1.0\r\nUser-Agent: foobar\r \n", PARSE_RESULT_ERROR, 45}, {"GET /index.html HTTP/1.0\r\nUser-Agent: foobar\r\n\r\n***BODY****", PARSE_RESULT_DONE, 48}, {"GET", PARSE_RESULT_ERROR, 3}, {"GET /index.html", PARSE_RESULT_ERROR, 15}, From 171af7b3339bcf0f6731f0f8ea217cb22870b088 Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Fri, 6 Aug 2021 23:19:08 +0000 Subject: [PATCH 11/12] Fix line endings on x_effective_url test --- .../x_effective_url/{none.in => none.test_input} | 10 +++++----- .../xdebug/x_effective_url/{one.in => one.test_input} | 10 +++++----- .../x_effective_url/{three.in => three.test_input} | 10 +++++----- .../xdebug/x_effective_url/{two.in => two.test_input} | 10 +++++----- .../xdebug/x_effective_url/x_effective_url.test.py | 2 +- 5 files changed, 21 insertions(+), 21 deletions(-) rename tests/gold_tests/pluginTest/xdebug/x_effective_url/{none.in => none.test_input} (93%) rename tests/gold_tests/pluginTest/xdebug/x_effective_url/{one.in => one.test_input} (93%) rename tests/gold_tests/pluginTest/xdebug/x_effective_url/{three.in => three.test_input} (93%) rename tests/gold_tests/pluginTest/xdebug/x_effective_url/{two.in => two.test_input} (93%) diff --git a/tests/gold_tests/pluginTest/xdebug/x_effective_url/none.in b/tests/gold_tests/pluginTest/xdebug/x_effective_url/none.test_input similarity index 93% rename from tests/gold_tests/pluginTest/xdebug/x_effective_url/none.in rename to tests/gold_tests/pluginTest/xdebug/x_effective_url/none.test_input index e07b30662f5..c9c47a8c297 100644 --- a/tests/gold_tests/pluginTest/xdebug/x_effective_url/none.in +++ b/tests/gold_tests/pluginTest/xdebug/x_effective_url/none.test_input @@ -1,5 +1,5 @@ -GET /argh HTTP/1.1 -Host: none -X-Debug: X-Effective-URL -Connection: close - +GET /argh HTTP/1.1 +Host: none +X-Debug: X-Effective-URL +Connection: close + diff --git a/tests/gold_tests/pluginTest/xdebug/x_effective_url/one.in b/tests/gold_tests/pluginTest/xdebug/x_effective_url/one.test_input similarity index 93% rename from tests/gold_tests/pluginTest/xdebug/x_effective_url/one.in rename to tests/gold_tests/pluginTest/xdebug/x_effective_url/one.test_input index d9223256128..f27ecc620db 100644 --- a/tests/gold_tests/pluginTest/xdebug/x_effective_url/one.in +++ b/tests/gold_tests/pluginTest/xdebug/x_effective_url/one.test_input @@ -1,5 +1,5 @@ -GET /argh HTTP/1.1 -Host: one -X-Debug: x-effective-url -Connection: close - +GET /argh HTTP/1.1 +Host: one +X-Debug: x-effective-url +Connection: close + diff --git a/tests/gold_tests/pluginTest/xdebug/x_effective_url/three.in b/tests/gold_tests/pluginTest/xdebug/x_effective_url/three.test_input similarity index 93% rename from tests/gold_tests/pluginTest/xdebug/x_effective_url/three.in rename to tests/gold_tests/pluginTest/xdebug/x_effective_url/three.test_input index 7076c1a249c..ec1a09aaaa5 100644 --- a/tests/gold_tests/pluginTest/xdebug/x_effective_url/three.in +++ b/tests/gold_tests/pluginTest/xdebug/x_effective_url/three.test_input @@ -1,5 +1,5 @@ -GET /argh HTTP/1.1 -Host: three123 -X-Debug: X-effective-url -Connection: close - +GET /argh HTTP/1.1 +Host: three123 +X-Debug: X-effective-url +Connection: close + diff --git a/tests/gold_tests/pluginTest/xdebug/x_effective_url/two.in b/tests/gold_tests/pluginTest/xdebug/x_effective_url/two.test_input similarity index 93% rename from tests/gold_tests/pluginTest/xdebug/x_effective_url/two.in rename to tests/gold_tests/pluginTest/xdebug/x_effective_url/two.test_input index 52ded33b4f0..9a1fd140a75 100644 --- a/tests/gold_tests/pluginTest/xdebug/x_effective_url/two.in +++ b/tests/gold_tests/pluginTest/xdebug/x_effective_url/two.test_input @@ -1,5 +1,5 @@ -GET /argh HTTP/1.1 -Host: two -X-Debug: X-EFFECTIVE-URL -Connection: close - +GET /argh HTTP/1.1 +Host: two +X-Debug: X-EFFECTIVE-URL +Connection: close + diff --git a/tests/gold_tests/pluginTest/xdebug/x_effective_url/x_effective_url.test.py b/tests/gold_tests/pluginTest/xdebug/x_effective_url/x_effective_url.test.py index ed1c3b54300..6323110b039 100644 --- a/tests/gold_tests/pluginTest/xdebug/x_effective_url/x_effective_url.test.py +++ b/tests/gold_tests/pluginTest/xdebug/x_effective_url/x_effective_url.test.py @@ -61,7 +61,7 @@ def sendMsg(msgFile): tr = Test.AddTestRun() tr.Processes.Default.Command = ( - "( python3 {}/tcp_client.py 127.0.0.1 {} {}/{}.in".format( + "( python3 {}/tcp_client.py 127.0.0.1 {} {}/{}.test_input".format( Test.RunDirectory, ts.Variables.port, Test.TestDirectory, msgFile) + " ; echo '======' ) | sed 's/:{}/:SERVER_PORT/' >> {}/out.log 2>&1 ".format( server.Variables.Port, Test.RunDirectory) From 4227afa044c881108ce58de69a57dec97024f91d Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Wed, 18 Aug 2021 18:56:41 +0000 Subject: [PATCH 12/12] Fix up tls_0rtt_server test --- tests/gold_tests/tls/early_h1_post.test_input | 2 +- .../{early_h2_get.txt => early_h2_get.test_input} | Bin ...rly_h2_multi1.txt => early_h2_multi1.test_input} | Bin ...rly_h2_multi2.txt => early_h2_multi2.test_input} | Bin .../{early_h2_post.txt => early_h2_post.test_input} | Bin tests/gold_tests/tls/test-0rtt-s_client.py | 2 +- tests/gold_tests/tls/tls_0rtt_server.test.py | 8 ++++---- 7 files changed, 6 insertions(+), 6 deletions(-) rename tests/gold_tests/tls/{early_h2_get.txt => early_h2_get.test_input} (100%) rename tests/gold_tests/tls/{early_h2_multi1.txt => early_h2_multi1.test_input} (100%) rename tests/gold_tests/tls/{early_h2_multi2.txt => early_h2_multi2.test_input} (100%) rename tests/gold_tests/tls/{early_h2_post.txt => early_h2_post.test_input} (100%) diff --git a/tests/gold_tests/tls/early_h1_post.test_input b/tests/gold_tests/tls/early_h1_post.test_input index 6d7cb5f7d0f..3cdf49d857e 100644 --- a/tests/gold_tests/tls/early_h1_post.test_input +++ b/tests/gold_tests/tls/early_h1_post.test_input @@ -1,6 +1,6 @@ POST /early_post HTTP/1.1 Host: 127.0.0.1 -Content-Length: 11 +Content-Length: 11 knock knock diff --git a/tests/gold_tests/tls/early_h2_get.txt b/tests/gold_tests/tls/early_h2_get.test_input similarity index 100% rename from tests/gold_tests/tls/early_h2_get.txt rename to tests/gold_tests/tls/early_h2_get.test_input diff --git a/tests/gold_tests/tls/early_h2_multi1.txt b/tests/gold_tests/tls/early_h2_multi1.test_input similarity index 100% rename from tests/gold_tests/tls/early_h2_multi1.txt rename to tests/gold_tests/tls/early_h2_multi1.test_input diff --git a/tests/gold_tests/tls/early_h2_multi2.txt b/tests/gold_tests/tls/early_h2_multi2.test_input similarity index 100% rename from tests/gold_tests/tls/early_h2_multi2.txt rename to tests/gold_tests/tls/early_h2_multi2.test_input diff --git a/tests/gold_tests/tls/early_h2_post.txt b/tests/gold_tests/tls/early_h2_post.test_input similarity index 100% rename from tests/gold_tests/tls/early_h2_post.txt rename to tests/gold_tests/tls/early_h2_post.test_input diff --git a/tests/gold_tests/tls/test-0rtt-s_client.py b/tests/gold_tests/tls/test-0rtt-s_client.py index d2a90447c87..576976ea30a 100644 --- a/tests/gold_tests/tls/test-0rtt-s_client.py +++ b/tests/gold_tests/tls/test-0rtt-s_client.py @@ -28,7 +28,7 @@ def main(): http_ver = sys.argv[2] test = sys.argv[3] sess_file_path = os.path.join(sys.argv[4], 'sess.dat') - early_data_file_path = os.path.join(sys.argv[4], 'early_{0}_{1}.txt'.format(http_ver, test)) + early_data_file_path = os.path.join(sys.argv[4], 'early_{0}_{1}.test_input'.format(http_ver, test)) s_client_cmd_1 = shlex.split( 'openssl s_client -connect 127.0.0.1:{0} -tls1_3 -quiet -sess_out {1}'.format(ats_port, sess_file_path)) diff --git a/tests/gold_tests/tls/tls_0rtt_server.test.py b/tests/gold_tests/tls/tls_0rtt_server.test.py index 039b953457c..07628c4aadf 100644 --- a/tests/gold_tests/tls/tls_0rtt_server.test.py +++ b/tests/gold_tests/tls/tls_0rtt_server.test.py @@ -102,10 +102,10 @@ ts.Setup.Copy('h2_early_decode.py') ts.Setup.Copy('early_h1_get.test_input') ts.Setup.Copy('early_h1_post.test_input') -ts.Setup.Copy('early_h2_get.txt') -ts.Setup.Copy('early_h2_post.txt') -ts.Setup.Copy('early_h2_multi1.txt') -ts.Setup.Copy('early_h2_multi2.txt') +ts.Setup.Copy('early_h2_get.test_input') +ts.Setup.Copy('early_h2_post.test_input') +ts.Setup.Copy('early_h2_multi1.test_input') +ts.Setup.Copy('early_h2_multi2.test_input') ts.Disk.records_config.update({ 'proxy.config.diags.debug.enabled': 1,