Patrick Barry created HTTPCLIENT-2211:
-----------------------------------------

             Summary: content-length header should not be sent when chunked 
encoding specified
                 Key: HTTPCLIENT-2211
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2211
             Project: HttpComponents HttpClient
          Issue Type: Bug
    Affects Versions: 5.1.3
            Reporter: Patrick Barry


According to HTTP 1.1 spec, content-length header should never be sent with 
Transfer-Encoding: chunked on request.  However, when you send a request using 
a non-body Method like GET or DELETE using this async client, it is adding 
content-length:0 to the request.  This header should not be sent according to 
RFC.

Because it is sent, it causes the server that is responding to either reject 
the request with a 400 or go down other paths. For example, Tomcat 9 chose to 
accept the request but will close the connection, even if Connection:Keep-Alive 
is requested on request.  This has major performance drawbacks, and is only one 
way a server chose to handle this.

 
As per RFC 7230:

<quote>
A sender MUST NOT send a Content-Length header field in any message that 
contains a Transfer-Encoding header field.
</quote>



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to