aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Uri.cpp2
-rw-r--r--test/src/UriTests.cpp3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/Uri.cpp b/src/Uri.cpp
index 3091b89..30c9671 100644
--- a/src/Uri.cpp
+++ b/src/Uri.cpp
@@ -1393,7 +1393,7 @@ namespace Uri {
}
if (!impl_->host.empty()) {
if (ValidateIpv6Address(impl_->host)) {
- buffer << '[' << impl_->host << ']';
+ buffer << '[' << NormalizeCaseInsensitiveString(impl_->host) << ']';
} else {
buffer << EncodeElement(impl_->host, REG_NAME_NOT_PCT_ENCODED);
}
diff --git a/test/src/UriTests.cpp b/test/src/UriTests.cpp
index 2e5f2d6..106aade 100644
--- a/test/src/UriTests.cpp
+++ b/test/src/UriTests.cpp
@@ -803,6 +803,9 @@ TEST(UriTests, GenerateString) {
{"http", "bob", "www.example.com", true, 8080, {"", "a c", "def"}, true, "foobar", true, "ch2", "http://bob@www.example.com:8080/a%20c/def?foobar#ch2"},
{"http", "bob", "www.example.com", true, 8080, {"", "abc", "def"}, true, "foo ar", true, "ch2", "http://bob@www.example.com:8080/abc/def?foo%20ar#ch2"},
{"http", "bob", "www.example.com", true, 8080, {"", "abc", "def"}, true, "foobar", true, "c 2", "http://bob@www.example.com:8080/abc/def?foobar#c%202"},
+
+ // normalization of IPv6 address hex digits
+ {"http", "bob", "fFfF::1", true, 8080, {"", "abc", "def"}, true, "foobar", true, "c 2", "http://bob@[ffff::1]:8080/abc/def?foobar#c%202"},
};
size_t index = 0;
for (const auto& testVector : testVectors) {