RFR: 8328919: Add BodyHandlers / BodySubscribers methods to handle excessive server input [v9]

Jaikiran Pai jpai at openjdk.org
Tue Jan 21 11:19:38 UTC 2025


On Mon, 20 Jan 2025 08:31:18 GMT, Volkan Yazıcı <duke at openjdk.org> wrote:

>> Adds `limiting()` factory methods to `HttpResponse.Body{Handlers,Subscribers}` to handle excessive server input in `HttpClient`. I would appreciate your input whether `discardExcess` should be kept or dropped. I plan to file a CSR once there is an agreement on the PR.
>
> Volkan Yazıcı has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix `HttpResponse` copyright year

test/jdk/java/net/httpclient/HttpResponseLimitingTest.java line 150:

> 148:             var request = HttpRequest
> 149:                     .newBuilder(requestUri)
> 150:                     .timeout(Duration.ofSeconds(5))

Given the context of this test class, I think configuring the request with a timeout shouldn't be necessary. In general, we rarely use timeouts (hardcoded ones specifically) in our tests because these tests run on a variety of hosts (some of which are slow or are running too many tests concurrently) and thus there's no right value for the timeout and can lead to intermittent failures.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23096#discussion_r1923537431


More information about the net-dev mailing list