On Thu, 20 Feb 2025 18:44:53 GMT, Daniel Fuchs <dfu...@openjdk.org> wrote:
> Hi - Please find here a PR that improves streaming strategy in the HttpClient. > > The HttpClient currently waits until the full request body has been sent > before starting to listen for a response. This is not optimal, in particular > in cases where the server sends back e.g. 500 without even reading the body. > It also prevents starting to stream the response body from the server before > having sent the full request body, which prevents the server to stream back > the request body to the client without reading it fully first. > > While writing a test to verify the fix, I also noticed a few places where > additional tasks needed to be performed asynchronously (= delegated to the > executor) to support this. test/jdk/java/net/httpclient/PostFromGetTest.java line 451: > 449: httpTestServer = HttpTestServer.create(HTTP_1_1, null, > serverExecutor); > 450: httpTestServer.addHandler(h1_chunkHandler, "/http1/x/"); > 451: httpURI = "http://" + httpTestServer.serverAuthority() + > "/http1/x/"; There has been occasions where a request got incorrectly served by a parallel running test. Last time we've salted the paths: https://github.com/openjdk/jdk/blob/f529bf712d8946584999dfc98abea60c22c97167/test/jdk/java/net/httpclient/PlainProxyConnectionTest.java#L77 We can consider doing the same here too. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23716#discussion_r1971247892