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

Jaikiran Pai jpai at openjdk.org
Wed Jan 15 14:09:43 UTC 2025


On Wed, 15 Jan 2025 10:50:55 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:
> 
>   Remove concurrency measures (methods are accessed serially due to the Reactive Streams spec)

src/java.net.http/share/classes/java/net/http/HttpResponse.java line 772:

> 770:             Objects.requireNonNull(downstreamHandler, "downstreamHandler");
> 771:             if (capacity < 0) {
> 772:                 throw new IllegalArgumentException("was expecting \"capacity >= 0\", found: " + capacity);

Nit - in some other areas, we use messages of the form `("capacity must not be negative: " + capacity)`. The current proposed message is more commonly used in test case exceptions, so it feels a bit odd to be seeing it in this form.

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

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


More information about the net-dev mailing list