RFR: 8308024: HttpClient (HTTP/1.1) sends an extraneous empty chunk if the BodyPublisher supplies an empty buffer [v2]
Daniel Fuchs
dfuchs at openjdk.org
Mon May 15 16:31:54 UTC 2023
> When using HTTP/1.1, if a BodyPublisher reports an unknown length (-1), the HttpClient will send the request body in Chunked mode. If the publisher publishes an empty byte buffer, the client will generate an empty chunk, which the server will interpret as the end of the request body. Sending an empty chunk can never be valid, unless it's the last body chunk and marks the end of the body.
>
> A new subclass of `AbstractNoBody.java` `NoBodyPartThree.java` is created to check this scenario. While at it, the tests `java/net/httpclient/NoBodyPartOne.java` and `java/net/httpclient/NoBodyPartTwo.java` which create a lot of clients are also updated to make use of `HttpClient::close`.
Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision:
Add bug id
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13988/files
- new: https://git.openjdk.org/jdk/pull/13988/files/1b5b0507..2b6e7f07
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13988&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13988&range=00-01
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/13988.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13988/head:pull/13988
PR: https://git.openjdk.org/jdk/pull/13988
More information about the net-dev
mailing list