hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
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
Date Tue, 07 Oct 2008 19:51:44 GMT
On 07/10/2008, olegk@apache.org <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 <olegk at apache.org>
>  +
>   * [HTTPCORE-174] Position is incremented twice in ContentLengthInputStream#skip(long)
>    Contributed by Ildar Safarov <ildar.safarov at gmail.com>
>
>
>  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


Mime
View raw message