remm        02/01/10 07:45:32

  Modified:    http11/src/java/org/apache/coyote/http11/filters
                        IdentityInputFilter.java
  Log:
  - The filter was incorrectly reading and discarding extra bytes.
  
  Revision  Changes    Path
  1.7       +8 -9      
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/filters/IdentityInputFilter.java
  
  Index: IdentityInputFilter.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/filters/IdentityInputFilter.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- IdentityInputFilter.java  10 Jan 2002 12:53:50 -0000      1.6
  +++ IdentityInputFilter.java  10 Jan 2002 15:45:32 -0000      1.7
  @@ -151,31 +151,30 @@
       public int doRead(ByteChunk chunk)
           throws IOException {
   
  -        buffer.doRead(chunk);
  -
  -        int result = chunk.getLength();
  -
  -        if (result <= 0) {
  -            return -1;
  -        }
  +        int result = 0;
   
           if (contentLength > 0) {
               if (remaining > 0) {
  -                if (chunk.getLength() > remaining) {
  +                int nRead = buffer.doRead(chunk);
  +                if (nRead > remaining) {
                       // The chunk is longer than the number of bytes remaining
                       // in the body; changing the chunk length to the number
                       // of bytes remaining
                       chunk.setBytes(chunk.getBytes(), chunk.getStart(), 
                                      (int) remaining);
                       result = (int) remaining;
  +                } else {
  +                    result = nRead;
                   }
  -                remaining = remaining - chunk.getLength();
  +                remaining = remaining - nRead;
               } else {
                   // No more bytes left to be read : return -1 and clear the 
                   // buffer
                   chunk.recycle();
                   result = -1;
               }
  +        } else {
  +            result = buffer.doRead(chunk);
           }
   
           return result;
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to