You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Mohit Anchlia <mo...@gmail.com> on 2012/01/20 00:02:16 UTC

ClientProtocolException

When we do a POST we are getting the following exception?
Transfer-encoding is set chunked. Not sure why it's throwing this
exception

org.apache.http.client.ClientProtocolException
        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:822)
        at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)

Caused by: org.apache.http.ProtocolException: Transfer-encoding header
already present

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


Re: ClientProtocolException

Posted by Mohit Anchlia <mo...@gmail.com>.
I agree, didn't realize that code was setting it manually.

On Fri, Jan 20, 2012 at 1:59 AM, Oleg Kalnichevski <ol...@apache.org> wrote:
> On Thu, 2012-01-19 at 15:02 -0800, Mohit Anchlia wrote:
>> When we do a POST we are getting the following exception?
>> Transfer-encoding is set chunked. Not sure why it's throwing this
>> exception
>>
>> org.apache.http.client.ClientProtocolException
>>         at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:822)
>>         at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
>>
>> Caused by: org.apache.http.ProtocolException: Transfer-encoding header
>> already present
>>
>
> You'll be much better off not messing with entity delineating headers
> such as 'transfer-encoding' and 'content-length' and letting HttpClient
> generate them for you.
>
> Oleg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>

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


Re: ClientProtocolException

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2012-01-19 at 15:02 -0800, Mohit Anchlia wrote:
> When we do a POST we are getting the following exception?
> Transfer-encoding is set chunked. Not sure why it's throwing this
> exception
> 
> org.apache.http.client.ClientProtocolException
>         at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:822)
>         at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
> 
> Caused by: org.apache.http.ProtocolException: Transfer-encoding header
> already present
> 

You'll be much better off not messing with entity delineating headers
such as 'transfer-encoding' and 'content-length' and letting HttpClient
generate them for you.

Oleg 



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


Re: ClientProtocolException

Posted by William Speirs <ws...@apache.org>.
I think because there is a modifier which is setting this header, then
you're trying to do it manually and getting this exception. What happens if
you remove the manual setting of the header?

Bill-
On Jan 19, 2012 6:02 PM, "Mohit Anchlia" <mo...@gmail.com> wrote:

> When we do a POST we are getting the following exception?
> Transfer-encoding is set chunked. Not sure why it's throwing this
> exception
>
> org.apache.http.client.ClientProtocolException
>        at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:822)
>        at
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
>
> Caused by: org.apache.http.ProtocolException: Transfer-encoding header
> already present
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>