Your issue is not related to transfer-encoding. The wire log you have
doesn't show "Transfer-Encoding: Chunked" as a response header. But it
does show this important line:

2011/09/08 16:08:13:433 PDT [DEBUG] headers - << Content-Length: 0

This says that the server is replying with no body after the headers.
I'd direction your attention at the server and try to work out why it
is sending a zero reply.

Thanks,

Sam



On 9 September 2011 00:20, Sudeep Pradhan <[email protected]> wrote:
> Sam,
>
> I got the following wire log:
>
> 2011/09/08 16:08:13:009 PDT [DEBUG] DefaultClientConnectionOperator - 
> Connecting to <HOST_IP>:8443
> 2011/09/08 16:08:13:167 PDT [DEBUG] RequestAddCookies - CookieSpec selected: 
> best-match
> 2011/09/08 16:08:13:195 PDT [DEBUG] RequestAuthCache - Re-using cached 
> 'basic' auth scheme for https://<HOST_IP>:8443
> 2011/09/08 16:08:13:216 PDT [DEBUG] ContentEncodingHttpClient - Attempt 1 to 
> execute request
> 2011/09/08 16:08:13:217 PDT [DEBUG] DefaultClientConnection - Sending 
> request: GET /<RESOURCE> HTTP/1.1
> 2011/09/08 16:08:13:217 PDT [DEBUG] headers - >> GET /<RESOURCE> HTTP/1.1
> 2011/09/08 16:08:13:218 PDT [DEBUG] headers - >> Host: <HOST_IP>:8443
> 2011/09/08 16:08:13:218 PDT [DEBUG] headers - >> Connection: Keep-Alive
> 2011/09/08 16:08:13:218 PDT [DEBUG] headers - >> User-Agent: 
> Apache-HttpClient/4.1.2 (java 1.5)
> 2011/09/08 16:08:13:218 PDT [DEBUG] headers - >> Authorization: Basic 
> <XXXXXXX>
> 2011/09/08 16:08:13:218 PDT [DEBUG] headers - >> Accept-Encoding: gzip,deflate
> 2011/09/08 16:08:13:433 PDT [DEBUG] DefaultClientConnection - Receiving 
> response: HTTP/1.1 200 OK
> 2011/09/08 16:08:13:433 PDT [DEBUG] headers - << HTTP/1.1 200 OK
> 2011/09/08 16:08:13:433 PDT [DEBUG] headers - << Server: Apache-Coyote/1.1
> 2011/09/08 16:08:13:433 PDT [DEBUG] headers - << Pragma: No-cache
> 2011/09/08 16:08:13:433 PDT [DEBUG] headers - << Cache-Control: no-cache
> 2011/09/08 16:08:13:433 PDT [DEBUG] headers - << Expires: Wed, 31 Dec 1969 
> 16:00:00 PST
> 2011/09/08 16:08:13:433 PDT [DEBUG] headers - << Set-Cookie: 
> JSESSIONID=CD1CBA1256AA6AEF1831DD05A9BF2A79; Path=/; Secure
> 2011/09/08 16:08:13:433 PDT [DEBUG] headers - << Content-Length: 0
> 2011/09/08 16:08:13:433 PDT [DEBUG] headers - << Date: Thu, 08 Sep 2011 
> 23:08:13 GMT
> 2011/09/08 16:08:13:441 PDT [DEBUG] ResponseProcessCookies - Cookie accepted: 
> "[version: 0][name: JSESSIONID][value: 
> CD1CBA1256AA6AEF1831DD05A9BF2A79][domain: <HOST_IP>][path: /][expiry: null]".
> 2011/09/08 16:08:13:443 PDT [DEBUG] ContentEncodingHttpClient - Connection 
> can be kept alive indefinitely
> 2011/09/08 16:08:13:445 PDT [DEBUG] SingleClientConnManager - Releasing 
> connection 
> org.apache.http.impl.conn.SingleClientConnManager$ConnAdapter@5f6303
> 2011/09/08 16:08:13:446 PDT [DEBUG] DefaultClientConnection - Connection shut 
> down
>
> When I make the same request through curl (which works correctly) I get the 
> following trace:
>
>> GET /<RESOURCE> HTTP/1.1
>> Authorization: Basic <XXXXXXX>
>> User-Agent: curl/7.21.6 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k 
>> zlib/1.2.3.3 libidn/1.15
>> Host: <HOST_IP>:8443
>> Accept: */*
> < HTTP/1.1 200 OK
> < Server: Apache-Coyote/1.1
> < Set-Cookie: JSESSIONID=6E56B97F2D3D30A3022A20B2D30F6690; Path=/; Secure
> < Transfer-Encoding: chunked
> < Date: Thu, 08 Sep 2011 23:12:58 GMT
>
> Notice, *Accept-Encoding* and *Connection* headers are not present in the 
> curl request. Can this be the cause of error.
>
> Hope this is helpful.
>
> Thanks,
> Sudeep
>
> -----Original Message-----
> From: Sam Crawford [mailto:[email protected]]
> Sent: Thursday, September 08, 2011 3:37 PM
> To: HttpClient User Discussion
> Subject: Re: Transfer Encoding chunked
>
> Sudeep,
>
> HttpClient will handle unchunking the responses for you.
>
> Can you post a wire log? See
> http://hc.apache.org/httpcomponents-client-ga/logging.html
>
> Thanks,
>
> Sam
>
>
> On 8 September 2011 23:28, Sudeep Pradhan <[email protected]> wrote:
>> Hi,
>>
>> Is there a tutorial of how to parse the chunked response from the server. I 
>> am using httpclient-4.1.2. The connection is HTTPS and uses basic 
>> authentication. I am able to get responses which are not chunked. But I am 
>> not able to get chunked responses.
>>
>> Please help me in this problem.
>>
>> Thanks,
>> Sudeep
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

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

Reply via email to