Merge branch 'topic/frerich/gh-750-uri-with-empty-portnum' of https://github.com/frerich/zeek

* 'topic/frerich/gh-750-uri-with-empty-portnum' of https://github.com/frerich/zeek:
  Document recent fix for decompose_uri in release notes
  Fixed decompose_uri choking on URIs with empty port component
  Adding test for decompose_uri parsing URI with empty port
This commit is contained in:
Jon Siwek 2020-01-24 15:15:04 -08:00
commit 0412cb3996
6 changed files with 16 additions and 2 deletions

View file

@ -1,4 +1,8 @@
3.1.0-dev.403 | 2020-01-24 15:15:04 -0800
* Fixed decompose_uri() errors on URIs with empty port component (Frerich Raabe)
3.1.0-dev.398 | 2020-01-23 18:08:43 -0800
* Skip check for outdated docs in Cirrus CI for PRs (Jon Siwek, Corelight)

5
NEWS
View file

@ -67,6 +67,11 @@ Changed Functionality
previously used. Output from the formatters remains nearly
identical.
- The ``decompose_uri`` function no longer raises an error when parsing
URIs with an empty port number (e.g. ``http://example.org:/``). Instead,
the ``portnum`` component of the returned ``URI`` value is left
uninitialized.
Removed Functionality
---------------------

View file

@ -1 +1 @@
3.1.0-dev.398
3.1.0-dev.403

View file

@ -119,8 +119,11 @@ function decompose_uri(uri: string): URI
# Parse location and port.
parts = split_string1(s, /:/);
u$netlocation = parts[0];
if ( parts[1] != "" )
{
u$portnum = to_count(parts[1]);
}
}
else
{
u$netlocation = s;

View file

@ -6,6 +6,7 @@
[scheme=http, netlocation=hyphen-example.com, portnum=<uninitialized>, path=/index.asp, file_name=index.asp, file_base=index, file_ext=asp, params={
[q] = 123
}]
[scheme=git, netlocation=git.kernel.org, portnum=<uninitialized>, path=/pub/scm/linux/, file_name=<uninitialized>, file_base=<uninitialized>, file_ext=<uninitialized>, params=<uninitialized>]
[scheme=<uninitialized>, netlocation=dfasjdfasdfasdf, portnum=<uninitialized>, path=/, file_name=<uninitialized>, file_base=<uninitialized>, file_ext=<uninitialized>, params={
}]

View file

@ -8,6 +8,7 @@ print decompose_uri("https://www.example.com/");
print decompose_uri("http://example.com:99/test//?foo=bar");
print decompose_uri("ftp://1.2.3.4/pub/files/something.exe");
print decompose_uri("http://hyphen-example.com/index.asp?q=123");
print decompose_uri("git://git.kernel.org:/pub/scm/linux/");
# This is mostly undefined behavior but it doesn't give any
# reporter messages at least.