On Thu, 8 Jun 2023 15:08:22 GMT, Daniel Fuchs <[email protected]> wrote:

>> test/jdk/java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java 
>> line 428:
>> 
>>> 426:         URL url = URIBuilder.newBuilder()
>>> 427:                 .scheme("http")
>>> 428:                 .host(InetAddress.getLoopbackAddress())
>> 
>> This will change the call flow of the test in a slightly subtle way. In the 
>> original the "host" is supplied i.e. localhost which should map to the 
>> loopback address, and in the change the loopback IP address is being 
>> supplied diectly. In terms of equivalence then supplying a host string might 
>> be more appropriate:
>> .host("localhost")
>
> No that's precisely what we want to avoid. Because how "localhost" maps to an 
> InetAddress depends on the machine configuration, which is a recipe for 
> intermittent failures.
> 
> I'd suggest:
> 
>         URL url = URIBuilder.newBuilder()
>                 .scheme("http")
>                 .localhost()
> 
> (which is actually the same)

At a glance there isn't a `.localhost()` only a `.loopback()` is that what you 
were referring to?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14177#discussion_r1223236970

Reply via email to