-
Sub-task
-
Resolution: Delivered
-
P4
-
26
`java.net.HttpClient` has been updated to stop sending the `Content-Length` header on HTTP/1.1 requests using a [method](https://docs.oracle.com/en/java/javase/25/docs/api/java.net.http/java/net/http/HttpRequest.Builder.html#method(java.lang.String,java.net.http.HttpRequest.BodyPublisher)) other than `POST` or `PUT` when provided with a `BodyPublisher` that reports a `contentLength()` of zero bytes.
This behavior follows the recommendations in RFC 9110: HTTP Semantics.
Users who need the header may add it using the HttpRequest Builder. The header is restricted by default, and needs to be allowed by setting the system property `jdk.httpclient.allowRestrictedHeaders` to include `content-length`.
This behavior follows the recommendations in RFC 9110: HTTP Semantics.
Users who need the header may add it using the HttpRequest Builder. The header is restricted by default, and needs to be allowed by setting the system property `jdk.httpclient.allowRestrictedHeaders` to include `content-length`.