You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Daniel Dyląg (JIRA)" <ji...@apache.org> on 2018/02/08 10:35:00 UTC

[jira] [Closed] (HTTPCORE-512) GET request should not include Content-Length header

     [ https://issues.apache.org/jira/browse/HTTPCORE-512?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Dyląg closed HTTPCORE-512.
---------------------------------
    Resolution: Implemented

I have noticed that it was implemented in 5.x branch. 

> GET request should not include Content-Length header
> ----------------------------------------------------
>
>                 Key: HTTPCORE-512
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-512
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>            Reporter: Daniel Dyląg
>            Priority: Major
>
> According to RFC 7230, chapter 3.3.2:
> {noformat}
>  A user agent SHOULD NOT send a Content-Length header field when the request message does not contain a payload body and the method semantics do not anticipate such a body.
> {noformat}
>  
> This most importantly includes GET method. Instead, in RequestContent class, this header is always added if there is no entity. 
> {code:java}
> if (entity == null) {
>  request.addHeader(HTTP.CONTENT_LEN, "0");
>  return;
> }{code}
>  
> Some servers take advantage of this rule and make incorrect assumptions when dealing with requests from this library.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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