- I've changed/extended the URI record fields a bit:
        - path is always the full path including the full file name
        - if there's no path, the field still still be set set "/".
        - file_name is the full name including extenstion, and
          file_base and file_ext split it out.

    - Adding a test exercising a bunch of URLs.
This commit is contained in:
Robin Sommer 2014-11-18 12:06:41 -08:00
commit 9d3cfaddaa
5 changed files with 193 additions and 1 deletions

View file

@ -0,0 +1,33 @@
# @TEST-EXEC: bro -b %INPUT > output
# @TEST-EXEC: btest-diff output
@load base/utils/urls
function dc(s: string)
{
print fmt("%s", s);
print fmt(" -> %s", decompose_uri(s));
print "";
}
event bro_init()
{
dc("https://www.bro.org:42/documentation/faq.html?k1=v1&k2=v2");
dc("");
dc("https://");
dc("https://www.bro.org");
dc("https://www.bro.org/");
dc("https://www.bro.org:42");
dc("https://www.bro.org:42/");
dc("https://www.bro.org/documentation");
dc("https://www.bro.org/documentation/");
dc("https://www.bro.org/documentation/faq");
dc("https://www.bro.org/documentation/faq.html");
dc("https://www.bro.org/documentation/faq.html?");
dc("https://www.bro.org/documentation/faq.html?k=v");
dc("https://www.bro.org/documentation/faq.html?k=");
dc("https://www.bro.org/documentation/faq.html?=v");
dc("file:///documentation/faq.html?=v");
dc("www.bro.org/?foo=bar");
}