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

Jaikiran Pai jpai at openjdk.org
Tue Jan 21 15:19:39 UTC 2025


On Tue, 21 Jan 2025 10:58:57 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 two additional commits since the last revision:
> 
>  - Fix `assertThrows` in `HttpResponseLimitingTest`
>  - Fix `HttpResponseLimitingTest` license header

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

> 753:         /**
> 754:          * {@return a {@code BodyHandler} limiting the number of body bytes
> 755:          * consumed and passed to the given downstream {@code BodyHandler}}

Would rewording this to:


{@return a {@code BodyHandler} that limits the number of body bytes
that are delivered to the given {@code downstreamHandler}}

be more concise?

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

> 1382:         /**
> 1383:          * {@return a {@code BodySubscriber} limiting the number of body bytes
> 1384:          * consumed and passed to the given downstream {@code BodySubscriber}}

Similar suggestion as the one I made for `BodyHandlers.limiting()`:


{@return a {@code BodySubscriber} that limits the number of body bytes
that are delivered to the given {@code downstreamSubscriber}}

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

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


More information about the net-dev mailing list