Regarding 8220575: Correctly format test URI's that contain a retrieved IPv6 address
Arthur Eubanks
aeubanks at google.com
Thu Mar 14 17:44:50 UTC 2019
Most of these eventually turn the String into a URL, so using a URL
directly should work?
jshell> URL u = new URL("http", "::1", 9002, "/")
u ==> http://[::1]:9002/
jshell> URL u = new URL("http",
InetAddress.getLoopbackAddress().getHostAddress(), 9002, "/")
u ==> http://127.0.0.1:9002/
jshell> URL u = new URL("http",
InetAddress.getLoopbackAddress().getHostName(), 9002, "/")
u ==> http://localhost:9002/
On Thu, Mar 14, 2019 at 9:40 AM Chris Hegarty <chris.hegarty at oracle.com>
wrote:
> It's just a hack, but enough to get me started so I can asses some of
> what is needed to support running the tests on an IPv6-only environment.
>
> http://cr.openjdk.java.net/~chegar/ipv6-only-hack/
>
> My /etc/hosts file has entries for `localhost` and the _host_, that
> return `::1`.
>
> This is enough to get started, but it will run out of road quite soon.
> And it will break some things. Let's work towards getting a better
> solution.
>
> Also, we will need test library support for determining whether the
> platform supports: 1) IPv4, or 2) IPv6, or 3) IPv4&IPv6. I filed 8220673
> [1] to tracks this.
>
> ---
>
> Regarding what to do with URL's in test. I tried a few different
> approaches, I am leaning towards:
>
> String host = loopbackAddress.getHostAddress();
> if (host.contains(":"))
> host = "[" + host + "]";
>
> Since it:
> 1) is relatively short and concise, and
> 2) ensures, in many cases, that the client and server use the same
> IP address, and
> 3) clearly shows the actual IP protocol in use, e.g.
> http://[0:0:0:0:0:0:0:1]:46009/zero/xxyy
>
> A sample of some tests that have been updated as above:
> http://cr.openjdk.java.net/~chegar/8220575/webrev.0.1/ (not too bad!)
>
> -Chris.
>
> P.S. I ran into an implementation bug and filed, 8220663: "Incorrect
> handling of IPv6 addresses in Socket(Proxy.HTTP)" - the fix is straight
> forward.
>
> [1] https://bugs.openjdk.java.net/browse/JDK-8220673
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20190314/5c3acdb4/attachment.html>
More information about the net-dev
mailing list