From 6ba1d1dcd39c2493cdf2308821cf923fe025d448 Mon Sep 17 00:00:00 2001 From: Alexey Mokeev Date: Sun, 27 Oct 2019 11:17:53 +0300 Subject: [PATCH] Make http::build_url work correctly --- scripts/base/protocols/http/utils.zeek | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/base/protocols/http/utils.zeek b/scripts/base/protocols/http/utils.zeek index a48841cef5..487cbcf113 100644 --- a/scripts/base/protocols/http/utils.zeek +++ b/scripts/base/protocols/http/utils.zeek @@ -55,9 +55,13 @@ function extract_keys(data: string, kv_splitter: pattern): string_vec function build_url(rec: Info): string { local uri = rec?$uri ? rec$uri : "/"; + if ( strstr(uri, "://") != 0 ) + return uri; + local host = rec?$host ? rec$host : addr_to_uri(rec$id$resp_h); - if ( rec$id$resp_p != 80/tcp ) - host = fmt("%s:%s", host, rec$id$resp_p); + local resp_p = port_to_count(rec$id$resp_p); + if ( resp_p != 80 ) + host = fmt("%s:%s", host, resp_p); return fmt("%s%s", host, uri); }