remm        2004/05/14 14:14:14

  Modified:    catalina/src/share/org/apache/coyote/tomcat5
                        InputBuffer.java
  Log:
  - Fix readLine again (actually, it's not readLine that I keep on trying to fix, it's 
mark
    and reset functionality).
  - Avoid creating a buffer the size of the request body when using readLine to read
    the entire body with small strings (note: it's not a very big deal, since 
allocating
    this many Strings would be really bad for performance).
  - Bug 28959, and Jim Hopp submitted a good test case.
  
  Revision  Changes    Path
  1.7       +13 -1     
jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/InputBuffer.java
  
  Index: InputBuffer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/InputBuffer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- InputBuffer.java  8 Mar 2004 23:48:50 -0000       1.6
  +++ InputBuffer.java  14 May 2004 21:14:14 -0000      1.7
  @@ -425,8 +425,20 @@
           if (cb.getLength() <= 0) {
               cb.setOffset(0);
               cb.setEnd(0);
  +        } else {
  +            if ((cb.getBuffer().length > (2 * size)) 
  +                && (cb.getLength()) < (cb.getStart())) {
  +                System.arraycopy(cb.getBuffer(), cb.getStart(), 
  +                                 cb.getBuffer(), 0, cb.getLength());
  +                cb.setEnd(cb.getLength());
  +                cb.setOffset(0);
  +            }
           }
  -        cb.setLimit(cb.getStart() + readAheadLimit);
  +        int offset = readAheadLimit;
  +        if (offset < size) {
  +            offset = size;
  +        }
  +        cb.setLimit(cb.getStart() + offset);
           markPos = cb.getStart();
       }
   
  
  
  

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

Reply via email to