RFR: 8208693: HttpClient: Extend the request timeout's scope to cover the response body
Volkan Yazici
vyazici at openjdk.org
Wed Oct 22 11:54:35 UTC 2025
On Thu, 16 Oct 2025 18:00:00 GMT, Rajan Halade <rhalade 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.
Updated as requested in 29e0cdee3ac.
> 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.
Updated as requested in 29e0cdee3ac.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27469#discussion_r2447418290
PR Review Comment: https://git.openjdk.org/jdk/pull/27469#discussion_r2447417450
More information about the net-dev
mailing list