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

Jaikiran Pai jpai at openjdk.org
Tue Jan 21 10:52:37 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 93:

> 91:                 IOException.class,
> 92:                 () -> requestBytes(version, secure, insufficientCapacity),
> 93:                 "body exceeds capacity: " + RESPONSE_BODY.length);

The 3rd parameter here is the message representing the failure of the assert. In its current form if this test fails (i.e. the IOException isn't thrown), then the failure message will say "body exceeds capacity: X" which I think is a bit misleading since it gives an impression that the response body has exceeded capacity.

I think changing that message to something like `"No IOException thrown for capacity: " + insufficientCapacity` might be a bit more clear.

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

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


More information about the net-dev mailing list