RFR: 8318130: SocksSocketImpl needlessly encodes hostname for IPv6 addresses
Alan Bateman
alanb at openjdk.org
Fri Oct 20 07:36:36 UTC 2023
On Thu, 19 Oct 2023 12:10:02 GMT, Daniel Jeliński <djelinski 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.
Reading this makes me wonder if there are cases where ProxySelector.getDefault() returns null? I had thought we would only have a ProxySelector on macOS or when there is configuration but it looks like sun.net.spi.DefaultProxySelector will always be loaded. Do I read this correctly? The reason for asking is that I'm surprised the modified code is used for the common case, I expected it would only be used when there is configuration.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16265#issuecomment-1772231280
More information about the net-dev
mailing list