Return-Path: Delivered-To: apmail-hc-dev-archive@www.apache.org Received: (qmail 42067 invoked from network); 7 Oct 2008 19:53:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Oct 2008 19:53:15 -0000 Received: (qmail 9112 invoked by uid 500); 7 Oct 2008 19:53:14 -0000 Delivered-To: apmail-hc-dev-archive@hc.apache.org Received: (qmail 8915 invoked by uid 500); 7 Oct 2008 19:53:13 -0000 Mailing-List: contact dev-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list dev@hc.apache.org Received: (qmail 8904 invoked by uid 99); 7 Oct 2008 19:53:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Oct 2008 12:53:13 -0700 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=DNS_FROM_SECURITYSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sebbaz@gmail.com designates 209.85.217.21 as permitted sender) Received: from [209.85.217.21] (HELO mail-gx0-f21.google.com) (209.85.217.21) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Oct 2008 19:52:11 +0000 Received: by gxk14 with SMTP id 14so6916972gxk.22 for ; Tue, 07 Oct 2008 12:51:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=F3Eyc9Lz/ZA6/f9hCRnk4TjhZhP3o2d6Vu/EdJnSJNI=; b=xBVJr1ZLmw9Z2SvLVdbhh79NNuRG9jr/1awVyN6Nfo5DGH9YEBvVVaA4j86nMCX0BL dybBDF7Xdt1NYCYo8Ve4BXQ43Bz/jd8rDE1pLkg+fnE8mCyNJuaEZp8Z+/O9KKfqmuif JnCiMvdipxcqIOkptw70WttKPhk9LzJKBghaI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=KCa+NcsCLhSR5Dh5Mu146VS5yUoD5pT4ihJAwd3bddyPgqChDV+P279wwnv4R6kBqP RVWGkqiLlnrsV7IOFYyaVZ3piRVxvUudN/OYk4rKl7picj9z79udz14P5FO+1wFCvJ7B wck6BrpcdwCljI3sbQbLrqFLFhtZRH/cI3EO0= Received: by 10.151.141.8 with SMTP id t8mr10306236ybn.247.1223409104813; Tue, 07 Oct 2008 12:51:44 -0700 (PDT) Received: by 10.150.140.17 with HTTP; Tue, 7 Oct 2008 12:51:44 -0700 (PDT) Message-ID: <25aac9fc0810071251v2a830d60vc04a6a969e316e0f@mail.gmail.com> Date: Tue, 7 Oct 2008 20:51:44 +0100 From: sebb To: "HttpComponents Project" Subject: Re: svn commit: r702599 - in /httpcomponents/httpcore/trunk: RELEASE_NOTES.txt module-main/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java module-main/src/test/java/org/apache/http/impl/io/TestChunkCoding.java In-Reply-To: <20081007193357.DB4F623888A6@eris.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20081007193357.DB4F623888A6@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org On 07/10/2008, olegk@apache.org wrote: > Author: olegk > Date: Tue Oct 7 12:33:57 2008 > New Revision: 702599 > > URL: http://svn.apache.org/viewvc?rev=702599&view=rev > Log: > HTTPCORE-173: Tolerate missing closing chunk if the chunk coded content is terminated by the end of stream (EOF) condition > > > Modified: > httpcomponents/httpcore/trunk/RELEASE_NOTES.txt > httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java > httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/io/TestChunkCoding.java > > Modified: httpcomponents/httpcore/trunk/RELEASE_NOTES.txt > URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt?rev=702599&r1=702598&r2=702599&view=diff > ============================================================================== > --- httpcomponents/httpcore/trunk/RELEASE_NOTES.txt (original) > +++ httpcomponents/httpcore/trunk/RELEASE_NOTES.txt Tue Oct 7 12:33:57 2008 > @@ -1,6 +1,10 @@ > Changes since 4.0 Beta 2 > ------------------- > > +* [HTTPCORE-173] Tolerate missing closing chunk if the chunk coded content > + is terminated by the end of stream (EOF) condition. > + Contributed by Oleg Kalnichevski > + > * [HTTPCORE-174] Position is incremented twice in ContentLengthInputStream#skip(long) > Contributed by Ildar Safarov > > > Modified: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java > URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java?rev=702599&r1=702598&r2=702599&view=diff > ============================================================================== > --- httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java (original) > +++ httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java Tue Oct 7 12:33:57 2008 > @@ -219,8 +219,7 @@ > this.buffer.clear(); > int i = this.in.readLine(this.buffer); > if (i == -1) { > - throw new MalformedChunkCodingException( > - "Chunked stream ended unexpectedly"); Perhaps log a message here, as it is non-standard? > + return 0; > } > int separator = this.buffer.indexOf(';'); > if (separator < 0) { > > Modified: httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/io/TestChunkCoding.java > URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/io/TestChunkCoding.java?rev=702599&r1=702598&r2=702599&view=diff > ============================================================================== > --- httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/io/TestChunkCoding.java (original) > +++ httpcomponents/httpcore/trunk/module-main/src/test/java/org/apache/http/impl/io/TestChunkCoding.java Tue Oct 7 12:33:57 2008 > @@ -205,6 +205,17 @@ > } > } > > + // Missing closing chunk > + public void testChunkedInputStreamNoClosingChunk() throws IOException { > + String s = "5\r\n01234\r\n"; > + ChunkedInputStream in = new ChunkedInputStream( > + new SessionInputBufferMockup( > + EncodingUtils.getBytes(s, CONTENT_CHARSET))); > + byte[] tmp = new byte[5]; > + assertEquals(5, in.read(tmp)); > + assertEquals(-1, in.read()); > + } > + > // Missing \r\n at the end of the first chunk > public void testCorruptChunkedInputStreamMissingCRLF() throws IOException { > String s = "5\r\n012345\r\n56789\r\n0\r\n"; > @@ -238,18 +249,6 @@ > } > } > > - // Missing closing chunk > - public void testCorruptChunkedInputStreamNoClosingChunk() throws IOException { > - InputStream in = new ChunkedInputStream( > - new SessionInputBufferMockup(new byte[] {})); > - try { > - in.read(); > - fail("MalformedChunkCodingException should have been thrown"); > - } catch(MalformedChunkCodingException e) { > - /* expected exception */ > - } > - } > - > // Invalid chunk size > public void testCorruptChunkedInputStreamInvalidSize() throws IOException { > String s = "whatever\r\n01234\r\n5\r\n56789\r\n0\r\n"; > > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org For additional commands, e-mail: dev-help@hc.apache.org