Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
HTTP/1.1 204 No Content
``
Connection: keep-alive
``
Cache-Control: no-store
Content-Length: 282
Content-Type: text/html
Expand All @@ -16,4 +18,4 @@ Content-Type: text/html
Description: According to rfc7231 I should not have been sent to you!<BR/>
This response was sent via the custom204plugin via a call to TSHttpTxnErrorBodySet.
<HR>
</BODY>
</BODY>
2 changes: 2 additions & 0 deletions tests/gold_tests/body_factory/gold/http-204-custom.gold
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
HTTP/1.1 204 No Content
``
Connection: keep-alive
``
Cache-Control: no-store
Content-Type: text/html
Content-Language: en
Expand Down
2 changes: 2 additions & 0 deletions tests/gold_tests/body_factory/gold/http-204.gold
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
HTTP/1.1 204 No Content
Date: ``
Connection: keep-alive
Server: ATS/``
Cache-Control: no-store

2 changes: 2 additions & 0 deletions tests/gold_tests/body_factory/gold/http-304.gold
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
HTTP/1.1 304 Not Modified
``
Connection: keep-alive
``
Cache-Control: no-store

2 changes: 1 addition & 1 deletion tests/gold_tests/body_factory/gold/http-get-200.gold
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ HTTP/1.1 200 OK
Content-Length: 47
``

This body should be returned for a GET request.
This body should be returned for a GET request.
2 changes: 1 addition & 1 deletion tests/gold_tests/body_factory/gold/http-get-304.gold
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HTTP/1.1 304 Not Modified
``
Warning: 199 VERSION Proxy received unexpected 304 response; content may be stale
Warning: 199 `` Proxy received unexpected 304 response; content may be stale
``
2 changes: 2 additions & 0 deletions tests/gold_tests/body_factory/gold/http-head-no-origin.gold
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
HTTP/1.1 404 Not Found
``
Connection: keep-alive
``
Cache-Control: no-store
Content-Type: text/html
Content-Language: en
Expand Down
9 changes: 4 additions & 5 deletions tests/gold_tests/body_factory/http204_response.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# limitations under the License.

import os
import sys

Test.Summary = '''
Tests that 204 responses conform to rfc2616, unless custom templates override.
Expand Down Expand Up @@ -76,18 +77,16 @@
defaultTr.Processes.Default.StartBefore(Test.Processes.ts)
defaultTr.StillRunningAfter = ts

defaultTr.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(DEFAULT_204_HOST))
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.TimeOut = 5 # seconds
defaultTr.Processes.Default.ReturnCode = 0
defaultTr.Processes.Default.Streams.stdout = "gold/http-204.gold"


customTemplateTr = Test.AddTestRun("Test domain {0}".format(CUSTOM_TEMPLATE_204_HOST))
customTemplateTr = Test.AddTestRun(f"Test domain {CUSTOM_TEMPLATE_204_HOST}")
customTemplateTr.StillRunningBefore = ts
customTemplateTr.StillRunningAfter = ts
customTemplateTr.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(CUSTOM_TEMPLATE_204_HOST))
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.TimeOut = 5 # seconds
customTemplateTr.Processes.Default.ReturnCode = 0
customTemplateTr.Processes.Default.Streams.stdout = "gold/http-204-custom.gold"
8 changes: 3 additions & 5 deletions tests/gold_tests/body_factory/http204_response_plugin.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# limitations under the License.

import os
import sys

Test.Summary = '''
Tests that plugins may break HTTP by sending 204 respose bodies
Expand All @@ -31,9 +32,7 @@
regex_remap_conf_file = "maps.reg"

ts.Disk.remap_config.AddLine(
'map http://{0} http://127.0.0.1:{1} @plugin=regex_remap.so @pparam={2} @pparam=no-query-string @pparam=host'
.format(CUSTOM_PLUGIN_204_HOST, server.Variables.Port,
regex_remap_conf_file)
f'map http://{CUSTOM_PLUGIN_204_HOST} http://127.0.0.1:{server.Variables.Port} @plugin=regex_remap.so @pparam={regex_remap_conf_file} @pparam=no-query-string @pparam=host'
)
ts.Disk.MakeConfigFile(regex_remap_conf_file).AddLine('//.*/ http://donotcare.test @status=204')

Expand All @@ -46,8 +45,7 @@
tr.Processes.Default.StartBefore(Test.Processes.ts)
tr.StillRunningAfter = ts

tr.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(CUSTOM_PLUGIN_204_HOST))
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.TimeOut = 5 # seconds
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "gold/http-204-custom-plugin.gold"
7 changes: 4 additions & 3 deletions tests/gold_tests/body_factory/http304_response.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# limitations under the License.

import os
import sys

Test.Summary = '''
Tests 304 responses
Expand All @@ -43,12 +44,12 @@
Test.Setup.Copy(os.path.join(os.pardir, os.pardir, 'tools', 'tcp_client.py'))
Test.Setup.Copy('data')

tr = Test.AddTestRun("Test domain {0}".format(DEFAULT_304_HOST))
tr = Test.AddTestRun(f"Test domain {DEFAULT_304_HOST}")
tr.Processes.Default.StartBefore(Test.Processes.ts)
tr.StillRunningAfter = ts

cmd_tpl = r"python3 tcp_client.py 127.0.0.1 {0} {1} | grep -v '^Date: '| grep -v '^Server: ATS/' | sed 's;ApacheTrafficServer\/[^ ]*;VERSION;'"
tr.Processes.Default.Command = cmd_tpl.format(ts.Variables.port, 'data/{0}_get.txt'.format(DEFAULT_304_HOST))
cmd_tpl = f"{sys.executable} tcp_client.py 127.0.0.1 {ts.Variables.port} data/{DEFAULT_304_HOST}_get.txt"
tr.Processes.Default.Command = cmd_tpl
tr.Processes.Default.TimeOut = 5 # seconds
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "gold/http-304.gold"
4 changes: 2 additions & 2 deletions tests/gold_tests/body_factory/http_head_no_origin.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# limitations under the License.

import os
import sys

Test.Summary = '''
Tests that HEAD requests return proper responses when origin fails
Expand All @@ -36,8 +37,7 @@
tr.Processes.Default.StartBefore(Test.Processes.ts)
tr.StillRunningAfter = ts

tr.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}_head.txt'.format(HOST))
tr.Processes.Default.Command = f"{sys.executable} tcp_client.py 127.0.0.1 {ts.Variables.port} data/{HOST}_head.txt"
tr.Processes.Default.TimeOut = 5 # seconds
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Streams.stdout = "gold/http-head-no-origin.gold"
11 changes: 5 additions & 6 deletions tests/gold_tests/body_factory/http_with_origin.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# limitations under the License.

import os
import sys

Test.Summary = '''
Tests that HEAD requests return proper responses
Expand Down Expand Up @@ -73,8 +74,7 @@
trhead200.StillRunningAfter = ts
trhead200.StillRunningAfter = server

trhead200.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}_head_200.txt'.format(HOST))
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.TimeOut = 5 # seconds
trhead200.Processes.Default.ReturnCode = 0
trhead200.Processes.Default.Streams.stdout = "gold/http-head-200.gold"
Expand All @@ -86,8 +86,7 @@
trget200.StillRunningAfter = ts
trget200.StillRunningAfter = server

trget200.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_200.txt'.format(HOST))
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.TimeOut = 5 # seconds
trget200.Processes.Default.ReturnCode = 0
trget200.Processes.Default.Streams.stdout = "gold/http-get-200.gold"
Expand All @@ -99,8 +98,8 @@
trget304.StillRunningAfter = ts
trget304.StillRunningAfter = server

cmd_tpl = r"python3 tcp_client.py 127.0.0.1 {0} {1} | grep -v '^Date: '| grep -v '^Server: ATS/' | sed 's;ApacheTrafficServer\/[^ ]*;VERSION;'"
trget304.Processes.Default.Command = cmd_tpl.format(ts.Variables.port, 'data/{0}_get_304.txt'.format(HOST))
cmd_tpl = f"{sys.executable} tcp_client.py 127.0.0.1 {ts.Variables.port} data/{HOST}_get_304.txt"
trget304.Processes.Default.Command = cmd_tpl
trget304.Processes.Default.TimeOut = 5 # seconds
trget304.Processes.Default.ReturnCode = 0
trget304.Processes.Default.Streams.stdout = "gold/http-get-304.gold"