RFR: 8354276: Strict HTTP header validation [v6]

Daniel Jeliński djelinski at openjdk.org
Wed Apr 30 09:30:05 UTC 2025


On Wed, 30 Apr 2025 08:55:26 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> test/jdk/java/net/httpclient/http2/BadPushPromiseTest.java line 87:
>> 
>>> 85:         int port = server.getAddress().getPort();
>>> 86:         System.err.println("Server listening on port " + port);
>>> 87:         uri = new URI("http://localhost:" + port + "/foo/a/b/c");
>> 
>> Hello Daniel, I think we should avoid `localhost` usage here and instead use `URIBuilder` test library util and then pass it  `InetAddress.getLoopbackAddress()` as the host. That should help avoid issues related to `localhost` being mapped to some other address and at the same time allow constructing the right URL when `InetAddress.getLoopbackAddress()` returns an IPv6 address.
>
> Ah - good point - you can also simply use `new URI("http://" + server.serverAuthority() + "/foo/a/b/c")`

Good catch! Switched to `serverAuthority()`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24569#discussion_r2068267507


More information about the net-dev mailing list