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: HttpClient does not seem to correctly handle chunked response
Date Wed, 20 Jan 2010 16:46:49 GMT
On Wed, 2010-01-20 at 08:20 -0800, Royan wrote:
> We have an XML API service which splits reply XML data into chunks if it is
> larger then certain amount of bytes. Here is the sample piece of the reply:
> 
> HTTP/1.1 200 OK
> Server: nginx/0.6.35
> Date: Wed, 20 Jan 2010 14:53:27 GMT
> Content-Type: text/xml;charset=UTF-8
> Transfer-Encoding: chunked
> Connection: keep-alive
> X-Powered-By: Servlet 2.4; JBoss-4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA
> date=200710221139)/Tomcat-5.5
> Connection: close
> 
> 1f0d
> <?xml version='1.0' encoding='UTF-8'?>
> <root>
> [...]
> <Label><![CDATA[Some character data br
> 2000
> oken in the middle of the string]]></Label>
> [...]
> <root>
> 
> 0
> 
> 
> The problem is when this XML is retrieved via
> httpResponse.getEntity().getContent() I expect all chunks to be transformed
> into single XML with no service information (I'm talking about some strange
> 2000 number appearing in the middle of the string)
> 
> In fact returned content is not always correctly parsed and contains such
> service information, which in turn makes my XML parser throw an exception
> 
> httpResponse.getEntity().isChunked() always retrieves "true"
> 
> Can anyone advice on what am I doing wrong or otherwise provide information
> how to workaround such issue?
> 
> Thanks,
> Roman 

I cannon recall a single confirmed problem with the correctness of the
chunk coding code in HttpClient in the past 7 (seven) years I am a
committer on the project. 

Double-check your code. If you are reasonably sure this is not an issue
with your code, post a _COMPLETE_ wire / context log of the session and
a test case reproducing the problem (preferably self-contained).

Oleg




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


Mime
View raw message