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 2015/06/16 11:24:52 UTC

svn commit: r1685744 - in /tomcat/trunk: java/org/apache/catalina/connector/Request.java test/org/apache/catalina/connector/TestRequest.java webapps/docs/config/ajp.xml webapps/docs/config/http.xml

Author: markt
Date: Tue Jun 16 09:24:52 2015
New Revision: 1685744

URL: http://svn.apache.org/r1685744
Log:
Remainder of fix for https://bz.apache.org/bugzilla/show_bug.cgi?id=57938
Change the meaning of maxPostSize="0" from unlimited to not allowed since:
- this is consistent with maxSavePostSize
- this is more intuitive
- Tomcat already behaved this way in some circumstances

Modified:
    tomcat/trunk/java/org/apache/catalina/connector/Request.java
    tomcat/trunk/test/org/apache/catalina/connector/TestRequest.java
    tomcat/trunk/webapps/docs/config/ajp.xml
    tomcat/trunk/webapps/docs/config/http.xml

Modified: tomcat/trunk/java/org/apache/catalina/connector/Request.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Request.java?rev=1685744&r1=1685743&r2=1685744&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/Request.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Request.java Tue Jun 16 09:24:52 2015
@@ -2696,7 +2696,7 @@ public class Request
                                 // Should not be possible
                             }
                         }
-                        if (maxPostSize > 0) {
+                        if (maxPostSize >= 0) {
                             // Have to calculate equivalent size. Not completely
                             // accurate but close enough.
                             if (charset == null) {
@@ -3008,7 +3008,7 @@ public class Request
 
             if (len > 0) {
                 int maxPostSize = connector.getMaxPostSize();
-                if ((maxPostSize > 0) && (len > maxPostSize)) {
+                if ((maxPostSize >= 0) && (len > maxPostSize)) {
                     Context context = getContext();
                     if (context != null && context.getLogger().isDebugEnabled()) {
                         context.getLogger().debug(
@@ -3100,7 +3100,7 @@ public class Request
         int len = 0;
         while (len > -1) {
             len = getStream().read(buffer, 0, CACHED_POST_LEN);
-            if (connector.getMaxPostSize() > 0 &&
+            if (connector.getMaxPostSize() >= 0 &&
                     (body.getLength() + len) > connector.getMaxPostSize()) {
                 // Too much data
                 checkSwallowInput();

Modified: tomcat/trunk/test/org/apache/catalina/connector/TestRequest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/connector/TestRequest.java?rev=1685744&r1=1685743&r2=1685744&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/connector/TestRequest.java (original)
+++ tomcat/trunk/test/org/apache/catalina/connector/TestRequest.java Tue Jun 16 09:24:52 2015
@@ -83,7 +83,7 @@ public class TestRequest extends TomcatB
         assertTrue(client.isResponse200());
         assertTrue(client.isResponseBodyOK());
         client.reset();
-        client.doRequest(0, false); // Unlimited
+        client.doRequest(0, false); // 0 bytes - too small should fail
         assertTrue(client.isResponse200());
         assertTrue(client.isResponseBodyOK());
         client.reset();

Modified: tomcat/trunk/webapps/docs/config/ajp.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/ajp.xml?rev=1685744&r1=1685743&r2=1685744&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/ajp.xml (original)
+++ tomcat/trunk/webapps/docs/config/ajp.xml Tue Jun 16 09:24:52 2015
@@ -113,7 +113,7 @@
     <attribute name="maxPostSize" required="false">
       <p>The maximum size in bytes of the POST which will be handled by
       the container FORM URL parameter parsing. The limit can be disabled by
-      setting this attribute to a value less than or equal to 0.
+      setting this attribute to a value less than zero.
       If not specified, this attribute is set to 2097152 (2 megabytes).</p>
     </attribute>
 

Modified: tomcat/trunk/webapps/docs/config/http.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/http.xml?rev=1685744&r1=1685743&r2=1685744&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/http.xml (original)
+++ tomcat/trunk/webapps/docs/config/http.xml Tue Jun 16 09:24:52 2015
@@ -122,7 +122,7 @@
     <attribute name="maxPostSize" required="false">
       <p>The maximum size in bytes of the POST which will be handled by
       the container FORM URL parameter parsing. The limit can be disabled by
-      setting this attribute to a value less than or equal to 0.
+      setting this attribute to a value less than zero.
       If not specified, this attribute is set to 2097152 (2 megabytes).</p>
     </attribute>
 



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