You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2005/05/22 19:12:11 UTC

cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11AprProcessor.java Http11AprProtocol.java Http11Processor.java Http11Protocol.java

markt       2005/05/22 10:12:11

  Modified:    http11/src/java/org/apache/coyote/http11
                        Http11AprProcessor.java Http11AprProtocol.java
                        Http11Processor.java Http11Protocol.java
  Log:
  Implement request body replay action.
  Use new maxSavePostSize attribute rather than maxPostSize to control size of POST buffered during SSL handshake.
  
  Revision  Changes    Path
  1.12      +17 -7     jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java
  
  Index: Http11AprProcessor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProcessor.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Http11AprProcessor.java	11 May 2005 11:23:26 -0000	1.11
  +++ Http11AprProcessor.java	22 May 2005 17:12:11 -0000	1.12
  @@ -36,6 +36,7 @@
   import org.apache.coyote.http11.filters.GzipOutputFilter;
   import org.apache.coyote.http11.filters.IdentityInputFilter;
   import org.apache.coyote.http11.filters.IdentityOutputFilter;
  +import org.apache.coyote.http11.filters.SavedRequestInputFilter;
   import org.apache.coyote.http11.filters.VoidInputFilter;
   import org.apache.coyote.http11.filters.VoidOutputFilter;
   import org.apache.coyote.http11.filters.BufferedInputFilter;
  @@ -268,9 +269,9 @@
   
   
       /**
  -     * Max post size.
  +     * Max save post size.
        */
  -    protected int maxPostSize = 2 * 1024 * 1024;
  +    protected int maxSavePostSize = 4 * 1024;
   
   
       /**
  @@ -626,16 +627,16 @@
       /**
        * Set the maximum size of a POST which will be buffered in SSL mode.
        */
  -    public void setMaxPostSize(int mps) {
  -        maxPostSize = mps;
  +    public void setMaxSavePostSize(int msps) {
  +        maxSavePostSize = msps;
       }
   
   
       /**
        * Return the maximum size of a POST which will be buffered in SSL mode.
        */
  -    public int getMaxPostSize() {
  -        return maxPostSize;
  +    public int getMaxSavePostSize() {
  +        return maxSavePostSize;
       }
   
   
  @@ -1103,7 +1104,7 @@
                    */
                   InputFilter[] inputFilters = inputBuffer.getFilters();
                   ((BufferedInputFilter) inputFilters[Constants.BUFFERED_FILTER])
  -                    .setLimit(maxPostSize);
  +                    .setLimit(maxSavePostSize);
                   inputBuffer.addActiveFilter
                       (inputFilters[Constants.BUFFERED_FILTER]);
                   try {
  @@ -1115,6 +1116,15 @@
                   } catch (Exception e) {
                       log.warn("Exception getting SSL Cert", e);
                   }
  +            } else if (actionCode == ActionCode.ACTION_REQ_SET_BODY_REPLAY) {
  +                ByteChunk body = (ByteChunk) param;
  +                
  +                InputFilter savedBody = new SavedRequestInputFilter(body);
  +                savedBody.setRequest(request);
  +
  +                InternalInputBuffer internalBuffer = (InternalInputBuffer)
  +                    request.getInputBuffer();
  +                internalBuffer.addActiveFilter(savedBody);
               }
           }
   
  
  
  
  1.5       +7 -9      jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProtocol.java
  
  Index: Http11AprProtocol.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11AprProtocol.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Http11AprProtocol.java	20 Apr 2005 16:40:52 -0000	1.4
  +++ Http11AprProtocol.java	22 May 2005 17:12:11 -0000	1.5
  @@ -35,11 +35,9 @@
   import org.apache.coyote.RequestInfo;
   import org.apache.tomcat.util.net.AprEndpoint;
   import org.apache.tomcat.util.net.SSLImplementation;
  -import org.apache.tomcat.util.net.SSLSupport;
   import org.apache.tomcat.util.net.ServerSocketFactory;
   import org.apache.tomcat.util.net.AprEndpoint.Handler;
   import org.apache.tomcat.util.res.StringManager;
  -import org.apache.tomcat.util.threads.ThreadWithAttributes;
   
   
   /**
  @@ -220,7 +218,7 @@
   
       private int maxKeepAliveRequests=100; // as in Apache HTTPD server
       private int timeout = 300000;   // 5 minutes as in Apache HTTPD server
  -    private int maxPostSize = 2 * 1024 * 1024;
  +    private int maxSavePostSize = 4 * 1024;
       private int maxHttpHeaderSize = 4 * 1024;
       private String reportedname;
       private int socketCloseDelay=-1;
  @@ -361,13 +359,13 @@
           setAttribute("compression", valueS);
       }
   
  -    public int getMaxPostSize() {
  -        return maxPostSize;
  +    public int getMaxSavePostSize() {
  +        return maxSavePostSize;
       }
   
  -    public void setMaxPostSize(int valueI) {
  -        maxPostSize = valueI;
  -        setAttribute("maxPostSize", "" + valueI);
  +    public void setMaxSavePostSize(int valueI) {
  +        maxSavePostSize = valueI;
  +        setAttribute("maxSavePostSize", "" + valueI);
       }
   
       public int getMaxHttpHeaderSize() {
  @@ -626,7 +624,7 @@
               processor.setCompressableMimeTypes( proto.compressableMimeTypes);
               processor.setRestrictedUserAgents( proto.restrictedUserAgents);
               processor.setSocketBuffer( proto.socketBuffer );
  -            processor.setMaxPostSize( proto.maxPostSize );
  +            processor.setMaxSavePostSize( proto.maxSavePostSize );
               processor.setServer( proto.server );
   
               thData[Http11AprProtocol.THREAD_DATA_PROCESSOR]=processor;
  
  
  
  1.120     +17 -7     jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java
  
  Index: Http11Processor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java,v
  retrieving revision 1.119
  retrieving revision 1.120
  diff -u -r1.119 -r1.120
  --- Http11Processor.java	14 Mar 2005 15:33:10 -0000	1.119
  +++ Http11Processor.java	22 May 2005 17:12:11 -0000	1.120
  @@ -40,6 +40,7 @@
   import org.apache.coyote.http11.filters.GzipOutputFilter;
   import org.apache.coyote.http11.filters.IdentityInputFilter;
   import org.apache.coyote.http11.filters.IdentityOutputFilter;
  +import org.apache.coyote.http11.filters.SavedRequestInputFilter;
   import org.apache.coyote.http11.filters.VoidInputFilter;
   import org.apache.coyote.http11.filters.VoidOutputFilter;
   import org.apache.coyote.http11.filters.BufferedInputFilter;
  @@ -269,9 +270,9 @@
   
   
       /**
  -     * Max post size.
  +     * Max saved post size.
        */
  -    protected int maxPostSize = 2 * 1024 * 1024;
  +    protected int maxSavePostSize = 4 * 1024;
   
   
       /**
  @@ -643,16 +644,16 @@
       /**
        * Set the maximum size of a POST which will be buffered in SSL mode.
        */
  -    public void setMaxPostSize(int mps) {
  -        maxPostSize = mps;
  +    public void setMaxSavePostSize(int msps) {
  +        maxSavePostSize = msps;
       }
   
   
       /**
        * Return the maximum size of a POST which will be buffered in SSL mode.
        */
  -    public int getMaxPostSize() {
  -        return maxPostSize;
  +    public int getMaxSavePostSize() {
  +        return maxSavePostSize;
       }
   
   
  @@ -1099,7 +1100,7 @@
                    */
                   InputFilter[] inputFilters = inputBuffer.getFilters();
                   ((BufferedInputFilter) inputFilters[Constants.BUFFERED_FILTER])
  -                    .setLimit(maxPostSize);
  +                    .setLimit(maxSavePostSize);
                   inputBuffer.addActiveFilter
                       (inputFilters[Constants.BUFFERED_FILTER]);
                   try {
  @@ -1112,6 +1113,15 @@
                       log.warn("Exception getting SSL Cert",e);
                   }
               }
  +        } else if (actionCode == ActionCode.ACTION_REQ_SET_BODY_REPLAY) {
  +            ByteChunk body = (ByteChunk) param;
  +            
  +            InputFilter savedBody = new SavedRequestInputFilter(body);
  +            savedBody.setRequest(request);
  +
  +            InternalInputBuffer internalBuffer = (InternalInputBuffer)
  +                request.getInputBuffer();
  +            internalBuffer.addActiveFilter(savedBody);
           }
   
       }
  
  
  
  1.64      +7 -7      jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java
  
  Index: Http11Protocol.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- Http11Protocol.java	14 Mar 2005 15:33:10 -0000	1.63
  +++ Http11Protocol.java	22 May 2005 17:12:11 -0000	1.64
  @@ -234,7 +234,7 @@
   
       private int maxKeepAliveRequests=100; // as in Apache HTTPD server
       private int timeout = 300000;   // 5 minutes as in Apache HTTPD server
  -    private int maxPostSize = 2 * 1024 * 1024;
  +    private int maxSavePostSize = 4 * 1024;
       private int maxHttpHeaderSize = 4 * 1024;
       private String reportedname;
       private int socketCloseDelay=-1;
  @@ -394,13 +394,13 @@
           setAttribute("compression", valueS);
       }
   
  -    public int getMaxPostSize() {
  -        return maxPostSize;
  +    public int getMaxSavePostSize() {
  +        return maxSavePostSize;
       }
   
  -    public void setMaxPostSize(int valueI) {
  -        maxPostSize = valueI;
  -        setAttribute("maxPostSize", "" + valueI);
  +    public void setMaxSavePostSize(int valueI) {
  +        maxSavePostSize = valueI;
  +        setAttribute("maxSavePostSize", "" + valueI);
       }
   
       public int getMaxHttpHeaderSize() {
  @@ -694,7 +694,7 @@
               processor.setCompressableMimeTypes( proto.compressableMimeTypes);
               processor.setRestrictedUserAgents( proto.restrictedUserAgents);
               processor.setSocketBuffer( proto.socketBuffer );
  -            processor.setMaxPostSize( proto.maxPostSize );
  +            processor.setMaxSavePostSize( proto.maxSavePostSize );
               processor.setServer( proto.server );
   
               thData[Http11Protocol.THREAD_DATA_PROCESSOR]=processor;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org