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
2 changes: 1 addition & 1 deletion plugins/esi/combo_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ parseQueryParameters(const char *query, int query_len, ClientRequest &creq)
}
}
param_start_pos = i + 1;
} else if (query[i] == ':') {
} else if ((query[i] == ':') && (colon_pos < param_start_pos)) {
colon_pos = i;
Comment on lines +715 to 716
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically: make sure colon_pos hasn't been set yet before setting it in case there is a : in the path too.

}
}
Expand Down
12 changes: 12 additions & 0 deletions tests/gold_tests/pluginTest/combo_handler/combo_handler.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def add_server_obj(content_type, path):
add_server_obj("text/javascript", "/sub/obj2")
add_server_obj("text/argh", "/obj3")
add_server_obj("application/javascript", "/obj4")
add_server_obj("application/javascript", "/s/assets/module:variant_v1.js")

ts = Test.MakeATSProcess("ts")

Expand All @@ -96,6 +97,7 @@ def add_server_obj(content_type, path):
ts.Disk.remap_config.AddLine('map http://xyz/ http://127.0.0.1/ @plugin=combo_handler.so')
ts.Disk.remap_config.AddLine(f'map http://localhost/127.0.0.1/ http://127.0.0.1:{server.Variables.Port}/')
ts.Disk.remap_config.AddLine(f'map http://localhost/sub/ http://127.0.0.1:{server.Variables.Port}/sub/')
ts.Disk.remap_config.AddLine(f'map http://localhost/s/ http://127.0.0.1:{server.Variables.Port}/s/')

# Configure the combo_handler's configuration file.
ts.Setup.Copy("ctwl.txt", ts.Variables.CONFIGDIR)
Expand All @@ -122,4 +124,14 @@ def add_server_obj(content_type, path):
f = tr.Disk.File("_output/2-tr-Default/stream.all.txt")
f.Content = "combo_handler_files/tr2.gold"

tr = Test.AddTestRun()
tr.Processes.Default.Command = tcp_client(
"127.0.0.1", ts.Variables.port,
"GET /admin/v1/combo?s:assets/module:variant_v1.js HTTP/1.1\n" + "Host: xyz\n" + "Connection: close\n" + "\n")
tr.Processes.Default.ReturnCode = 0
f = tr.Disk.File("_output/3-tr-Default/stream.all.txt")
f.Content = Testers.ContainsExpression("HTTP/1.1 200 OK", "Should successfully combine an object with a colon in its path")
f.Content += Testers.ContainsExpression(
"Content for /s/assets/module:variant_v1.js", "Should fetch the object path after the first colon")

ts.Disk.diags_log.Content = Testers.ContainsExpression("ERROR", "Some tests are failure tests")