oglueck 2002/10/16 06:11:35 Modified: httpclient/src/test/org/apache/commons/httpclient TestStreams.java Log: Added test case showing a problem with empty chunked streams. Revision Changes Path 1.4 +14 -0 jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestStreams.java Index: TestStreams.java =================================================================== RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestStreams.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestStreams.java 26 Sep 2002 12:40:33 -0000 1.3 +++ TestStreams.java 16 Oct 2002 13:11:35 -0000 1.4 @@ -67,6 +67,20 @@ } } + public void testEmptyChunkedInputStream() throws IOException { + String input = "0\r\n"; + HttpMethod method = new SimpleHttpMethod(); + + InputStream in = new ChunkedInputStream(new ByteArrayInputStream(input.getBytes()), method); + byte[] buffer = new byte[300]; + ByteArrayOutputStream out = new ByteArrayOutputStream(); + int len; + while ((len = in.read(buffer)) > 0) { + out.write(buffer, 0, len); + } + assertEquals(0, out.size()); + } + public void testContentLengthInputStream() throws IOException { String correct = "1234567890123456"; InputStream in = new ContentLengthInputStream(new ByteArrayInputStream(correct.getBytes()), 10);
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>