RFR: 8352431: java/net/httpclient/EmptyAuthenticate.java uses "localhost"

Jaikiran Pai jpai at openjdk.org
Wed Apr 9 11:33:30 UTC 2025


On Wed, 9 Apr 2025 11:12:31 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:

> Overhauls `EmptyAuthenticate` to
> 
> - Test all supported HTTP versions (i.e., HTTP/1.1 and HTTP/2)
> - Test both clear-text and SSL
> - Use `HttpServerAdapters.HttpTestServer::create` to avoid host-related problems

test/jdk/java/net/httpclient/EmptyAuthenticate.java line 83:

> 81:                     responseHeaders.firstValue(WWW_AUTH_HEADER_NAME).orElse(null),
> 82:                     () -> "was expecting empty `%s` header in: %s".formatted(
> 83:                             WWW_AUTH_HEADER_NAME, responseHeaders.map()));

Hello Volkan, this appears to be the opposite of what the original test case was expecting. Before this change, we had:

boolean ok = !response.headers().firstValue("WWW-Authenticate").isEmpty();
if (!ok) {
    throw new RuntimeException("WWW-Authenticate missing");
}

So the test was expecting the response header value to be non-empty unlike this updated version. Did I misread the code?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24542#discussion_r2035171076


More information about the net-dev mailing list