Hello Oleg, thank you for your quick reply!

First i'll ask a philosophic question. Is there any chance that such bug may
occur due to the fact the server which sends the XML reply uses HTTPClient
v.3 and my client which receives that reply is of version 4?  


Can you please go in a bit more detail on what do you mean by "context log
of the session"?

What actually happens -- I send raw xml in the body of HTTP Post request,
when the reply is received I eventually read it with XmlStreamReader (I
assume I do it from ChunkedInputStream) which fails with following
exception:

Caused by: com.sun.xml.stream.XMLStreamException2: ParseError at
[row,col]:[659,37]
Message: The character sequence "]]>" must not appear in content unless used
to mark the end of a CDATA section.
[StackTrace goes on]

If I simply output the contents of the received XML I can see those numbers
I mentioned earlier, which I assume are some chunk markers


I'll do my best to reproduce the problem and localize it in a standalone
test, but unfortunately I can not give you some public URL to the server
which generates XML as it is an internal server. 


Thanks,
Roman



olegk wrote:
> 
> 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-unsubscr...@hc.apache.org
> For additional commands, e-mail: httpclient-users-h...@hc.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/HttpClient-does-not-seem-to-correctly-handle-chunked-response-tp27244426p27250544.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


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

Reply via email to