[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpclient-commons-dev
Subject:    [jira] [Created] (HTTPCORE-759) Content-Length missing on null entity request content
From:       "Billy Jaime Beltran (Jira)" <jira () apache ! org>
Date:       2023-09-29 9:34:00
Message-ID: JIRA.13552406.1695980024000.111927.1695980040004 () Atlassian ! JIRA
[Download RAW message or body]

Billy Jaime Beltran created HTTPCORE-759:
--------------------------------------------

             Summary: Content-Length missing on null entity request content
                 Key: HTTPCORE-759
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-759
             Project: HttpComponents HttpCore
          Issue Type: Improvement
          Components: HttpCore
    Affects Versions: 5.2.2
            Reporter: Billy Jaime Beltran


When making a POST request with an empty body, the following difference in =
behaviour was observed.

In HttpComponents 4.4.x, a null body causes a Content-Length zero header to=
 be added.
In HttpComponents 5.2.x, a null body causes no Content-Length headers being=
 added.

While upgrading an Apache Camel application, we noticed that this breaks ca=
lls to an upstream IIS server which replies with 411 (Length Required).
That server expects either a Content-Length 0 or a Transfer-Encoding: chunk=
ed header (with a chunk-size of zero) on requests that have a body semantic=
 (POST, PUT).


As the code currently stands written, if we manually set `Content-Length: 0=
` a ProtocolException is thrown [RequestContent.java:106|https://github.com=
/apache/httpcomponents-core/blob/e3c770b55602eb9e5a45dfe7c6a07a1adede2c95/h=
ttpcore5/src/main/java/org/apache/hc/core5/http/protocol/RequestContent.jav=
a#L106]
and if we call the constructor with overwrite, this header is removed anywa=
y without being replaced.=C2=A0

The previous behaviour (4.x) is documented [RequestContent.java:102|https:/=
/github.com/apache/httpcomponents-core/blob/a5c117028b7c620974304636d52f06f=
172f1d08b/httpcore/src/main/java/org/apache/http/protocol/RequestContent.ja=
va#L102]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic