Integrated: 8358942: HttpClient adds Content-Length: 0 for a GET request with a BodyPublishers.noBody()

Daniel Jeliński djelinski at openjdk.org
Thu Oct 16 11:08:24 UTC 2025


On Thu, 9 Oct 2025 13:27:42 GMT, Daniel Jeliński <djelinski at openjdk.org> 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.

This pull request has now been integrated.

Changeset: ead35a75
Author:    Daniel Jeliński <djelinski at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/ead35a754bf3a545a1b68f28d3d939750f11af39
Stats:     160 lines in 2 files changed: 131 ins; 24 del; 5 mod

8358942: HttpClient adds Content-Length: 0 for a GET request with a BodyPublishers.noBody()

Reviewed-by: dfuchs, vyazici

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

PR: https://git.openjdk.org/jdk/pull/27727


More information about the net-dev mailing list