tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 InputBuffer.java
Date Fri, 14 May 2004 21:14:15 GMT
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: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message