RFR: 8350451: HttpClient should not wait until the request body has been fully sent before reading the response headers
Daniel Fuchs
dfuchs at openjdk.org
Thu Feb 20 18:50:28 UTC 2025
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.
-------------
Commit messages:
- 8350451: HttpClient should not wait until the request body has been fully sent before reading the response headers
Changes: https://git.openjdk.org/jdk/pull/23716/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23716&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8350451
Stats: 662 lines in 6 files changed: 644 ins; 5 del; 13 mod
Patch: https://git.openjdk.org/jdk/pull/23716.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/23716/head:pull/23716
PR: https://git.openjdk.org/jdk/pull/23716
More information about the net-dev
mailing list