To simulate a chunked transfer-encoding in the response, I wrote a pair of
client/servlet classes.
- The client makes a GET request with a query string of TestSide=xxx.
- The servlet picks up the GET request in doGet(), simulate a buffer
of TestSize, and send buffer back to the client using chunked
Transfer-Encoding
by calling response.setHeader( "Transfer-Encoding", "chunked");
- The client reads the response and validate the size as well as the data
(both server and client agree on a same random buffer generation scheme)
When testing against tomcat 4.1.27 using Cayote connector, on the way back,
client (httpclient) detects the chunked encoding, but it complains with the
following
stacktrace
java.io.IOException: chunked stream ended unexpectedly
at
org.apache.commons.httpclient.ChunkedInputStream.getChunkSizeFromInputStream
(ChunkedInputStream.java:268)
at
org.apache.commons.httpclient.ChunkedInputStream.nextChunk(ChunkedInputStrea
m.java:237)
at
org.apache.commons.httpclient.ChunkedInputStream.read(ChunkedInputStream.jav
a:162)
at java.io.FilterInputStream.read(FilterInputStream.java:66)
at
org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream
.java:122)
at com.borland.ebu.qa.web.TestChunked.testGet(TestChunked.java:140)
By looking at the stack trace, I suspect that Cayotee connector does not
handle
teh chunking protocol correctly at server side.May be this is why this
simple unit test case
is not include in the test suite.
Any advice?
-Dan
----- Original Message -----
From: "Michael Becke" <[EMAIL PROTECTED]>
To: "Commons HttpClient Project" <[EMAIL PROTECTED]>
Sent: Monday, September 01, 2003 10:44 AM
Subject: Re: HttpGet with Chunked response
> Hi Dan,
>
> HttpClient certainly handles chunked responses. Can you be more
> specific about what you are trying and what is failing? Stack traces
> and wire logs
> <http://jakarta.apache.org/commons/httpclient/logging.html> are always
> helpful.
>
> Mike
>
> On Monday, September 1, 2003, at 12:41 PM, Dan Tran wrote:
>
> > Hello,
> >
> > I run thru the httpclient unittest suite and notice a GET with
> > chunked reponse missing.
> >
> > So I create one where at the server I setup the
> > response to send back as chunk.
> >
> > The test fails agains tomcat 4.1 cayote connector.
> >
> > Is this test purposely left out? My guess here is cayotee
> > connector does not support chunked transfer ecoding in
> > the response.
> >
> > Please advice.
> >
> > -Dan
> >
>
>
> ---------------------------------------------------------------------
> 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]