RFR: 8318130: SocksSocketImpl needlessly encodes hostname for IPv6 addresses
Daniel Jeliński
djelinski at openjdk.org
Fri Oct 20 10:45:36 UTC 2023
On Fri, 20 Oct 2023 09:43:20 GMT, Michael McMahon <michaelm at openjdk.org> wrote:
>> This patch fixes the encoding of IPv6 addresses in the URI provided to ProxySelector.
>>
>> The original code percent-encoded the square brackets added around the IPv6 addresses, producing URIs that could not be parsed correctly.
>>
>> The proposed code does not percent-encode the IPv6 addresses at all.
>>
>> Added a test to verify that different forms of addresses are processed correctly. The test verifies the handling of IPv4 addresses, IPv6 without scope, IPv6 with numeric scope, IPv6 with textual scope (only if present on the machine running tests), hostnames and FQDNs
>>
>> Tier1-3 tests passed.
>
> src/java.base/share/classes/java/net/SocksSocketImpl.java line 304:
>
>> 302: if (epoint.getAddress() instanceof Inet6Address &&
>> 303: (host.indexOf(':') >= 0) &&
>> 304: isIPv6LiteralAddress(host)) {
>
> Is the check at line 303 still needed, now we are calling `isIPv6LiteralAddress` ?
it's optional, as is the check for `:`. I'll remove them.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16265#discussion_r1366805909
More information about the net-dev
mailing list