RFR: 8208693: HttpClient: Extend the request timeout's scope to cover the response body [v11]

Daniel Fuchs dfuchs at openjdk.org
Thu Nov 6 16:11:32 UTC 2025


On Thu, 6 Nov 2025 13:19:26 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:

>> Currently `HttpRequest::timeout` only applies until the response headers are received. Extend its scope to also cover the consumption of the response body.
>> 
>> ### Review guidelines
>> 
>> 1. Read _"the fix"_ in `MultiExchange`
>> 2. Skim through the test server *handler* in `TimeoutResponseTestSupport`
>> 3. Review first `TimeoutResponseHeaderTest`, and then `TimeoutResponseBodyTest` (Mind the multiple `@test` blocks!)
>
> Volkan Yazici has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Configure timeout for the `WebSocketTest`
>  - Use `var`

src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java line 391:

> 389:             // Ensure that the connection is closed or returned to the pool
> 390:             exch.nullBody(response, throwable);
> 391:         });

This might not be the correct place. Shouldn't we instead call `cancelTimer()` as soon as we know there won't be a body, after line 405 below, so that we are sure the timer is cancelled even in the case where a body not permitted is present?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27469#discussion_r2499671514


More information about the net-dev mailing list