-
Type:
Sub-task
-
Resolution: Delivered
-
Priority:
P4
-
Affects Version/s: 26
-
Component/s: core-libs
`java.net.HttpClient` has been updated to stop sending the `Content-Length` header on HTTP/1.1 requests using a [method][HttpRequest.Builder.method] 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`.