mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 20:18:20 +00:00
Merge branch 'Fix_http_build_url' of ssh://github.com/Olerdrive/zeek
I changed the format string of the port to %d and added a test.
This commit is contained in:
commit
9d7c9f37d4
5 changed files with 42 additions and 3 deletions
23
testing/btest/scripts/base/protocols/http/build-url.zeek
Normal file
23
testing/btest/scripts/base/protocols/http/build-url.zeek
Normal file
|
@ -0,0 +1,23 @@
|
|||
# @TEST-EXEC: zeek -r $TRACES/http/get.trace %INPUT >output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
function test(rec: HTTP::Info, expect: string)
|
||||
{
|
||||
local result = HTTP::build_url(rec);
|
||||
print fmt("Have: %s Expected: %s -> %s", result, expect, (result == expect ? "SUCCESS" : "FAIL"));
|
||||
}
|
||||
|
||||
event http_request(c: connection, method: string, original_URI: string, unescaped_URI: string, version: string) &priority=5
|
||||
{
|
||||
test(c$http, "192.150.187.43/download/CHANGES.bro-aux.txt");
|
||||
|
||||
# We fake some request instances for testing.
|
||||
c$http$id$resp_p = 123/tcp;
|
||||
test(c$http, "192.150.187.43:123/download/CHANGES.bro-aux.txt");
|
||||
|
||||
c$http$uri = "/";
|
||||
test(c$http, "192.150.187.43:123/");
|
||||
|
||||
c$http$uri = "http://proxied.host/some/document";
|
||||
test(c$http, "http://proxied.host/some/document");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue