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

Jaikiran Pai jpai at openjdk.org
Wed Jan 22 14:56:40 UTC 2025


On Wed, 22 Jan 2025 09:45:16 GMT, Volkan Yazici <vyazici 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 Yazici has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Verify `limiting()` doesn't affect header parsing

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

> 88:      * A header value larger than {@link #RESPONSE_BODY} to verify that {@code limiting()} doesn't affect header parsing.
> 89:      */
> 90:     private static final String RESPONSE_HEADER_VALUE = "!".repeat(RESPONSE_BODY.length);

Did you mean this to be:

"!".repeat(RESPONSE_BODY.length + 1);

`"x".repeat(1)` will generate a String of length 1.

In the context of what we are doing in this test, it won't matter though.

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

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


More information about the net-dev mailing list