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

Jaikiran Pai jpai at openjdk.org
Wed Jan 15 14:40:42 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)

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

> 74:     private static final Charset CHARSET = StandardCharsets.UTF_8;
> 75: 
> 76:     private static final HttpServer SERVER = new HttpServer();

Hello Volkan, is the use of a custom server implementation backed by reading/writing raw bytes on a `ServerSocket` intentional in this test? The test library in `/test/jdk/java/net/httpclient/lib` already has necessary test server implementations which we use in `HttpClient` tests to be able to run those tests for different protocol versions of HTTP (`test/jdk/java/net/httpclient/HttpClientLocalAddrTest.java` is one such arbitrary test).

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

> 181: 
> 182:         private static final byte[] RESPONSE = (
> 183:                 "HTTP/1.2 200 OK\r\n" +

Did you mean `HTTP/1.1`?

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

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


More information about the net-dev mailing list