diff options
author | Richard Walters <rwalters@digitalstirling.com> | 2018-07-01 14:45:45 -0700 |
---|---|---|
committer | Richard Walters <rwalters@digitalstirling.com> | 2018-07-01 14:45:45 -0700 |
commit | 6b9217cc7eeb72363f33a0b1330dcdca52d25f8e (patch) | |
tree | ed278cad505a5b57546ff59b03c947bc336e9468 /test | |
parent | 6c79c19334b53560ea9d2036da279994b8f83be4 (diff) |
Fix bug in parsing scheme
A colon may be in the authority, if present, so limit
the search for scheme delimiter so we aren't scanning
the authority part, when parsing the scheme.
Diffstat (limited to 'test')
-rw-r--r-- | test/src/UriTests.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/src/UriTests.cpp b/test/src/UriTests.cpp index d246a4d..1724b89 100644 --- a/test/src/UriTests.cpp +++ b/test/src/UriTests.cpp @@ -310,3 +310,20 @@ TEST(UriTests, ParseFromStringUserInfoBarelyLegal) { ++index; } } + +TEST(UriTests, ParseFromStringDontMisinterpretColonInAuthorityAsSchemeDelimiter) { + const std::vector< std::string > testVectors{ + {"//foo:bar@www.example.com/"}, + {"//www.example.com/a:b"}, + {"//www.example.com/foo?a:b"}, + {"//www.example.com/foo#a:b"}, + {"//[v7.:]/"}, + }; + size_t index = 0; + for (const auto& testVector : testVectors) { + Uri::Uri uri; + ASSERT_TRUE(uri.ParseFromString(testVector)) << index; + ASSERT_TRUE(uri.GetScheme().empty()); + ++index; + } +} |