RFR: 8353662: Add test for non-local file URL fallback to FTP [v2]

Daniel Fuchs dfuchs at openjdk.org
Fri Apr 4 10:28:59 UTC 2025


On Fri, 4 Apr 2025 10:24:25 GMT, Eirik Bjørsnøs <eirbjo at openjdk.org> wrote:

>> test/jdk/sun/net/www/protocol/file/NonLocalFtpFallback.java line 122:
>> 
>>> 120:     public void verifyNonLocalFtpFallback() throws Exception {
>>> 121:         URL localURL = file.toUri().toURL();
>>> 122:         URL nonLocalURL = new URL("file", "127.0.0.1", localURL.getFile());
>> 
>> The URL should not assume that the loopback is an IPv4 address. Or is this handled by the proxy?
>
>> The URL should not assume that the loopback is an IPv4 address. Or is this handled by the proxy?
> 
> Right. The following returns "127.0.0.1" for me, would that be the correct API to use?
> 
> `InetAddress.getLoopbackAddress().getHostAddress()`

Ok - I see that 127.0.0.1 should not be directly used. Would it work if we replaced that with a fake host name then?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24418#discussion_r2028549245


More information about the net-dev mailing list