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 CoyoteConnector.java CoyoteRequest.java LocalStrings.properties
Date Sat, 15 Nov 2003 09:45:02 GMT
remm        2003/11/15 01:45:02

  Modified:    catalina/src/share/org/apache/coyote/tomcat5
                        CoyoteConnector.java CoyoteRequest.java
                        LocalStrings.properties
  Log:
  - Add a limit to the size of a POST which will be processed using getParameter
    (which does allocate a significant amount of objects).
  
  Revision  Changes    Path
  1.32      +36 -1     jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteConnector.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- CoyoteConnector.java	10 Nov 2003 21:08:09 -0000	1.31
  +++ CoyoteConnector.java	15 Nov 2003 09:45:02 -0000	1.32
  @@ -272,10 +272,12 @@
        */
       private boolean secure = false;
   
  +
       /** For jk, do tomcat authentication if true, trust server if false 
        */ 
       private boolean tomcatAuthentication = true;
   
  +
       /**
        * The string manager for this package.
        */
  @@ -291,6 +293,7 @@
        */
       private boolean disableUploadTimeout = false;
   
  +
       /**
        * Maximum number of Keep-Alive requests to honor per connection.
        */
  @@ -298,6 +301,13 @@
   
   
       /**
  +     * Maximum size of a POST which will be automatically parsed by the 
  +     * container. 2MB by default.
  +     */
  +    private int maxPostSize = 2 * 1024 * 1024;
  +
  +
  +    /**
        * Has this component been initialized yet?
        */
       private boolean initialized = false;
  @@ -763,6 +773,31 @@
   
           this.maxProcessors = maxProcessors;
           setProperty("maxThreads", String.valueOf(maxProcessors));
  +
  +    }
  +
  +
  +    /**
  +     * Return the maximum size of a POST which will be automatically
  +     * parsed by the container.
  +     */
  +    public int getMaxPostSize() {
  +
  +        return (maxPostSize);
  +
  +    }
  +
  +
  +    /**
  +     * Set the maximum size of a POST which will be automatically
  +     * parsed by the container.
  +     *
  +     * @param maxPostSize The new maximum size in bytes of a POST which will 
  +     * be automatically parsed by the container
  +     */
  +    public void setMaxPostSize(int maxPostSize) {
  +
  +        this.maxPostSize = maxPostSize;
   
       }
   
  
  
  
  1.18      +8 -4      jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteRequest.java
  
  Index: CoyoteRequest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteRequest.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- CoyoteRequest.java	18 Sep 2003 22:50:08 -0000	1.17
  +++ CoyoteRequest.java	15 Nov 2003 09:45:02 -0000	1.18
  @@ -2320,6 +2320,10 @@
           int len = getContentLength();
   
           if (len > 0) {
  +            if (len > ((CoyoteConnector) connector).getMaxPostSize()) {
  +                log(sm.getString("coyoteRequest.postTooLarge"));
  +                return;
  +            }
               try {
                   byte[] formData = null;
                   if (len < CACHED_POST_LEN) {
  
  
  
  1.2       +1 -0      jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/LocalStrings.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LocalStrings.properties	19 Apr 2003 19:00:43 -0000	1.1
  +++ LocalStrings.properties	15 Nov 2003 09:45:02 -0000	1.2
  @@ -41,6 +41,7 @@
   coyoteRequest.listenerStart=Exception sending context initialized event to listener instance
of class {0}
   coyoteRequest.listenerStop=Exception sending context destroyed event to listener instance
of class {0}
   coyoteRequest.attributeEvent=Exception thrown by attributes event listener
  +coyoteRequest.postTooLarge=Parameters were not parsed because the size of the posted data
was too big. Use the maxPostSize attribute of the connector to resolve this if the application
should accept large POSTs.
   
   
   #
  
  
  

---------------------------------------------------------------------
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