[jdk17u] RFR: 8283544: HttpClient GET method adds Content-Length: 0 header

Goetz Lindenmaier goetz at openjdk.org
Thu Dec 4 14:08:47 UTC 2025


I backport this for parity with 17.0.18-oracle.

Clean backport. Original change is in 19.

The test does not build as https://bugs.openjdk.org/browse/JDK-8276559 (httpclient) Consider adding an HttpRequest.Builder.HEAD method to build a HEAD request.
is not in 17.  It was only added in 18.  Subtest headWithNoBody() is the problem.

I could replace the call to HEAD() by the implementation of that simple method.
This does not work though. The test uses the  HttpRequestBuilderImpl.  There
HEAD() is implemented as return method0("HEAD", null);
But method0 is private, and method() rejects null.

Using the implementation of the default method in HttpRequest does not work with HttpRequestBuilderImpl.
In this case the test returns a Http error 400.

Thus I just omit the test. See second commit.

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

Commit messages:
 - Exclude HEAD() test as 8276996 is not in 17
 - backport  6a7709320d28d8e1593b113fdf39ab583fca3687

Changes: https://git.openjdk.org/jdk17u/pull/413/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk17u&pr=413&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8283544
  Stats: 250 lines in 2 files changed: 236 ins; 6 del; 8 mod
  Patch: https://git.openjdk.org/jdk17u/pull/413.diff
  Fetch: git fetch https://git.openjdk.org/jdk17u.git pull/413/head:pull/413

PR: https://git.openjdk.org/jdk17u/pull/413


More information about the jdk-updates-dev mailing list