David Daney wrote:
The basic problem was that ChunkedInputStream.skip() would skip on the underlying InputStream. This bypassed the byte counting of the chunked protocol resulting in failure on reads following the skip.

The fix is to extent InputStream instead of FilterInputStream, as its skip method magically does the right thing. This requires that an implementation of available() and close() also be supplied. We can also use the super class' implementation of read(byte[]), so I removed that as well.

I am going to test this patch a bit more, but I think it is generally the right approach.

Comments?

2006-02-16  David Daney  <[EMAIL PROTECTED]>

    PR classpath/26312
    * gnu/java/net/protocol/http/ChunkedInputStream.java (imports): Cleaned
    up.
    (ChunkedInputStream): Extend InputStream.
    (in): New field.
    (headers): Moved to top of class.
    (constructor): Save referenct to in.
    (read(byte[])): Removed method.
    (read(byte[], int, int)): Made synchronized and throw IOException
    on error parsing chunk header.
    (available): New method.
    (close): New method.

After more testing I committed the patch as posted.

2006-02-27  David Daney  <[EMAIL PROTECTED]>

        PR classpath/26312
        * gnu/java/net/protocol/http/ChunkedInputStream.java (imports): Cleaned
        up.
        (ChunkedInputStream): Extend InputStream.
        (in): New field.
        (headers): Moved to top of class.
        (constructor): Save referenct to in.
        (read(byte[])): Removed method.
        (read(byte[], int, int)): Made synchronized and throw IOException
        on error parsing chunk header.
        (available): New method.
        (close): New method.

Reply via email to