diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2019-06-13 21:41:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-13 21:41:55 +0100 |
commit | e277ff4d7f95cb17eab4ae7a0fff94b1e5b3472c (patch) | |
tree | e3cf058bb67247dc93ed94c3ab8ebff6c7425c9a /tests | |
parent | 0c1029be9828cf3a6876efc9e2b1d315b7754d77 (diff) | |
parent | fb529a01bf1fe7cd577069e03007c693fba22392 (diff) | |
download | libgit2-e277ff4d7f95cb17eab4ae7a0fff94b1e5b3472c.tar.gz |
Merge pull request #5108 from libgit2/ethomson/urlparse_empty_port
Handle URLs with a colon after host but no port
Diffstat (limited to 'tests')
-rw-r--r-- | tests/network/urlparse.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/network/urlparse.c b/tests/network/urlparse.c index c2362e628..15707885a 100644 --- a/tests/network/urlparse.c +++ b/tests/network/urlparse.c @@ -61,6 +61,18 @@ void test_network_urlparse__implied_root_custom_port(void) cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0); } +void test_network_urlparse__implied_root_empty_port(void) +{ + cl_git_pass(git_net_url_parse(&conndata, "http://example.com:")); + cl_assert_equal_s(conndata.scheme, "http"); + cl_assert_equal_s(conndata.host, "example.com"); + cl_assert_equal_s(conndata.port, "80"); + cl_assert_equal_s(conndata.path, "/"); + cl_assert_equal_p(conndata.username, NULL); + cl_assert_equal_p(conndata.password, NULL); + cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); +} + void test_network_urlparse__encoded_password(void) { cl_git_pass(git_net_url_parse(&conndata, @@ -115,6 +127,18 @@ void test_network_urlparse__port(void) cl_assert_equal_i(git_net_url_is_default_port(&conndata), 0); } +void test_network_urlparse__empty_port(void) +{ + cl_git_pass(git_net_url_parse(&conndata, "http://example.com:/resource")); + cl_assert_equal_s(conndata.scheme, "http"); + cl_assert_equal_s(conndata.host, "example.com"); + cl_assert_equal_s(conndata.port, "80"); + cl_assert_equal_s(conndata.path, "/resource"); + cl_assert_equal_p(conndata.username, NULL); + cl_assert_equal_p(conndata.password, NULL); + cl_assert_equal_i(git_net_url_is_default_port(&conndata), 1); +} + void test_network_urlparse__user_port(void) { /* user@hostname.tld:port/resource */ |