diff options
-rw-r--r-- | src/Uri.cpp | 1 | ||||
-rw-r--r-- | test/src/UriTests.cpp | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/Uri.cpp b/src/Uri.cpp index 984d3ed..e0939bb 100644 --- a/src/Uri.cpp +++ b/src/Uri.cpp @@ -133,6 +133,7 @@ namespace Uri { } hostPortAndPathString = authorityAndPathString.substr(authorityEnd); } else { + impl_->userInfo.clear(); impl_->host.clear(); hostPortAndPathString = authorityAndPathString; } diff --git a/test/src/UriTests.cpp b/test/src/UriTests.cpp index a8ecd5b..6ee57c4 100644 --- a/test/src/UriTests.cpp +++ b/test/src/UriTests.cpp @@ -228,3 +228,10 @@ TEST(UriTests, ParseFromStringUserInfo) { ++index; } } + +TEST(UriTests, ParseFromStringTwiceFirstUserInfoThenWithout) { + Uri::Uri uri; + ASSERT_TRUE(uri.ParseFromString("http://joe@www.example.com/foo/bar")); + ASSERT_TRUE(uri.ParseFromString("/foo/bar")); + ASSERT_TRUE(uri.GetUserInfo().empty()); +} |