RFR: 8208693: HttpClient: Extend the request timeout's scope to cover the response body
Rajan Halade
rhalade at openjdk.org
Wed Oct 22 11:54:34 UTC 2025
On Wed, 24 Sep 2025 13:24:35 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!)
src/java.net.http/share/classes/java/net/http/HttpClient.java line 315:
> 313: * implementation should apply it over the duration measured from the
> 314: * instant a connection is requested to the instant that one is
> 315: * established. This duration includes SSL handshakes, if required.
Suggestion:
* When a connection timeout is configured, an {@link HttpClient} implementation
* applies it to the entire connection phase, from the moment a connection is
* requested until it is established. The elapsed time includes any SSL/TLS handshake.
src/java.net.http/share/classes/java/net/http/HttpRequest.java line 265:
> 263: *
> 264: * @implSpec
> 265: * When a timeout value is present, an {@link HttpClient}
Replace "When a timeout value is present" to "When a timeout is configured" for clarity in all occurrences in update.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27469#discussion_r2436952270
PR Review Comment: https://git.openjdk.org/jdk/pull/27469#discussion_r2436967724
More information about the net-dev
mailing list