[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-981?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12901453#action_12901453
 ] 

Oleg Kalnichevski commented on HTTPCLIENT-981:
----------------------------------------------

There is no easy solution to this problem. Users of HttpClient are generally 
advised to not mess around with protocol specific headers (especially 
Content-Length and Transfer-Encoding) and let HttpClient generate those headers 
automatically. So, if a request passed to HttpClient for execution encloses an 
entity it HttpClient ensures a proper composition of the message head and a 
correct delimitation of the content body.

One could run the request through the protocol processor in order to populate 
the request with all mandatory headers prior to passing it to the 
RequestProtocolCompliance validator. This would add up to the processing 
overhead and increase complexity of the cache implementation.

Oleg

> CachingHttpClient returns a 411 respones when executing a POST (HttpPost) 
> request 
> ----------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-981
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-981
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache
>    Affects Versions: 4.1 Alpha2
>            Reporter: Vianney Carel
>             Fix For: 4.1 Alpha3
>
>
> The CachingHttpClient validates requests prior executing them, by calling 
> RequestProtocolCompliance.requestIsFatallyNonCompliant(..).
> When executing an HttpPost, this method considers the request is invalid 
> because it does not contain (yet) a content-length header. Indeed, I observed 
> that this header is generated at the time the DefaultHttpClient fires the 
> request.
> NB: i'm using the Cache 4.1-alpha2 plugged over the HttpClient 4.0.1-final. I 
> can't use the latest version for both because I need to rely on a stable 
> version if there's any. I would be curious to know if we get the same 
> behaviour in 4.1...
> Anyway, I would see two fixes for that issue:
> - make HttpPost set the content-length at the time the entity is set,
> - or remove the validation step on the CachingHttpClient side.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to