You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by og...@apache.org on 2002/10/16 15:14:11 UTC

cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient ChunkedInputStream.java

oglueck     2002/10/16 06:14:11

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        ChunkedInputStream.java
  Log:
  Fixed hang with empty chunked streams.
  Fixed typo in CRLF checking.
  
  Revision  Changes    Path
  1.6       +8 -4      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ChunkedInputStream.java
  
  Index: ChunkedInputStream.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ChunkedInputStream.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ChunkedInputStream.java	26 Sep 2002 12:40:33 -0000	1.5
  +++ ChunkedInputStream.java	16 Oct 2002 13:14:11 -0000	1.6
  @@ -106,6 +106,10 @@
           this.in = in;
           this.method = method;
           this.chunkSize = getChunkSizeFromInputStream(in);
  +        if (chunkSize == 0) {
  +            eof = true;
  +            parseFooters();
  +        }
           this.pos = 0;
       }
   
  @@ -148,7 +152,7 @@
       private void nextChunk() throws IOException {
           int cr = in.read();
           int lf = in.read();
  -        if ((cr != '\r') &&
  +        if ((cr != '\r') ||
               (lf != '\n')) throw new IOException("CRLF expected at end of chunk: "+cr+"/"+lf);
           chunkSize = getChunkSizeFromInputStream(in);
           pos = 0;
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>