On Thu, 9 Oct 2025 13:27:42 GMT, Daniel Jeliński <[email protected]> wrote:
> Do not send the Content-Length header on HTTP/1.1 requests when the content
> length is known to be zero and the method does not expect content or is
> unknown.
>
> This brings the HTTP/1.1 implementation in line with the recommendations from
> RFC 9110.
>
> The existing ContentLengthHeaderTest was extended to cover the modified
> scenarios.
>
> Tier1-3 tests continue to pass.
test/jdk/java/net/httpclient/ContentLengthHeaderTest.java line 202:
> 200: assertEquals(resp.version(), version);
> 201: }
> 202:
Maybe you should add a test that verifies that Content-Length: 0 is still sent
if you do:
HttpRequest req = HttpRequest.newBuilder()
.version(version)
.method("GET", HttpRequest.BodyPublishers.noBody())
.header("Content-Length", "0")
.uri(uri)
.build();
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27727#discussion_r2419447591