hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Including Content-Length request header
Date Mon, 24 Oct 2016 19:04:24 GMT
On Sat, 2016-10-22 at 13:04 -0400, davidjesse091@aol.com wrote:
> I understand that HttpClient automatically includes the Content-Length request header
when passing a StringEntity. But I would like to set the position of the header. But when
I include the request header myself I get the following exception 
> "org.apache.http.ProtocolException: Content-Length header already present" 
> Is there anyway to bypass the auto inclusion of the Content-Length header?

If are really convinced this is a good idea you will have to remove
RequestContent interceptor from the protocol processing chain. 


The only way to do so it set a custom HttpProcessor when building
HttpClient instance with HttpClientBuilder. This can be done but one
needs to be careful when assembling a custom HttpProcessor. There are
several protocol interceptors whose absence in the protocol processing
chain is very likely to cause unexpected behavior. 

Proceed at your own risk.


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

View raw message