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
1 change: 0 additions & 1 deletion plugins/experimental/url_sig/url_sig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,6 @@ TSRemapDoRemap(void *ih, TSHttpTxn txnp, TSRemapRequestInfo *rri)
if (*new_path) {
TSUrlPathSet(rri->requestBufp, rri->requestUrl, new_path, strlen(new_path));
}
TSUrlHttpParamsSet(rri->requestBufp, rri->requestUrl, nullptr, 0);
}

TSfree((void *)current_url);
Expand Down
3 changes: 3 additions & 0 deletions tests/gold_tests/pluginTest/url_sig/url_sig.gold
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
< HTTP/1.1 200 OK
< HTTP/1.1 200 OK
< HTTP/1.1 200 OK
< HTTP/1.1 403 Forbidden
< HTTP/1.1 200 OK
< HTTP/1.1 200 OK
36 changes: 28 additions & 8 deletions tests/gold_tests/pluginTest/url_sig/url_sig.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,34 @@ def sign(payload, key):
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Command = (f"curl --verbose --proxy http://127.0.0.1:{ts.Variables.port} '{url}'" + LogTee)

# With client / MD5 / P=101 / URL pristine / URL altered.
# uses url_type pristine in config
tr = Test.AddTestRun()
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Command = (
f"curl --verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://ten.eleven.twelve/" +
"foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=586ef8e808caeeea025c525c89ff2638'" + LogTee)

# Single fail test - check for bad path param inserted
# With client / MD5 / P=101 / URL pristine / URL altered. Bad Path Param
# uses url_type pristine in config
tr = Test.AddTestRun()
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Command = (
f"curl --verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://ten.eleven.twelve/" +
"foo/abcde/qrstuvwxyz;badparam=true?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=586ef8e808caeeea025c525c89ff2638'" + LogTee)

# Success
# With client / SHA1 / P=1 / URL pristine / URL altered. Base64 Encoded Path Param
tr = Test.AddTestRun()
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Command = (
f"curl --verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://ten.eleven.twelve/" +
"foo/abcde;urlsig=Qz0xMjcuMC4wLjE7RT0zMzA0NjYyMDAwODtBPTI7Sz0xMztQPTEwMTtTPTA1MDllZjljY2VlNjUxZWQ1OTQxM2MyZjE3YmVhODZh/qrstuvwxyz'"
+ LogTee)

# Success
# This test must be last since it converts from the long to the short log output
# No client / SHA1 / P=1 / URL not pristine / URL not altered -- HTTPS.
#
path = "foo/abcde/qrstuvwxyz?E=33046618506&A=1&K=7&P=1&S="
Expand All @@ -233,14 +261,6 @@ def sign(payload, key):
f"curl --verbose --http1.1 --insecure --header 'Host: one.two.three' '{url}'" + LogTee +
" ; grep -F -e '< HTTP' -e Authorization {0}/url_sig_long.log > {0}/url_sig_short.log ".format(ts.RunDirectory))

# With client / MD5 / P=101 / URL pristine / URL altered.
# uses url_type pristine in config
tr = Test.AddTestRun()
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.Command = (
f"curl --verbose --proxy http://127.0.0.1:{ts.Variables.port} 'http://ten.eleven.twelve/" +
"foo/abcde/qrstuvwxyz?C=127.0.0.1&E=33046620008&A=2&K=13&P=101&S=586ef8e808caeeea025c525c89ff2638'" + LogTee)

# Overriding the built in ERROR check since we expect some ERROR messages
ts.Disk.diags_log.Content = Testers.ContainsExpression("ERROR", "Some tests are failure tests")
ts.Disk.diags_log.Content += Testers.ExcludesExpression("Error parsing", "Verify that we can accept long comment lines")