Description
Describe the bug
This is the same issue as #3244.
I pulled version 1.11.550, which I verified has the changes in awslabs/aws-crt-cpp#707 and the original issue doesn't seem to have actually been fixed.
I did a little digging and I think that when using v6 urls, the host string passed into IsValidHost
looks like [<ipv6>]
. That is, it includes the brackets. The changes in awslabs/aws-crt-cpp#707 don't look to be handling that.
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
I should be able to set an IPv6 address as my endpoint, and it should work.
Current Behavior
The client fails out with a message that the endpoint has an invalid DNS label.
Reproduction Steps
I wasn't trying to reach ::1, but you should be able to easily repro by instantiating a client with a config that has endpointOverride set to https://[::1]:80.
Possible Solution
@@ -45,11 +45,16 @@
{
// Valid DNS hostnames are composed of valid DNS labels separated by a period.
auto labels = StringUtils::Split(host, '.');
- if (labels.empty())
+ if (labels.empty())
{
return false;
}
+
+ if (host.at(0) == '[') {
+ return Aws::Crt::DnsUtils::IsValidIpV6(host.substr(1, host.size() - 2).c_str(), false);
+ }
+
return !std::any_of(labels.begin(), labels.end(), [](const Aws::String& label){ return !IsValidDnsLabel(label); }) || Aws::Crt::DnsUtils::IsValidIpV6(host.c_str(), false);
}
}
Additional Information/Context
No response
AWS CPP SDK version used
1.11.550
Compiler and Version used
clang 17
Operating System and version
Centos 9