Resolve some TODOs for "swallowAbortedUploads"
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 24 Mar 2011 13:24:28 +0000 (13:24 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 24 Mar 2011 13:24:28 +0000 (13:24 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1084949 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/connector/CometEventImpl.java
java/org/apache/catalina/connector/CoyoteAdapter.java
java/org/apache/catalina/connector/Request.java
java/org/apache/catalina/connector/Response.java

index f5e4fdc..34e9f20 100644 (file)
@@ -95,6 +95,7 @@ public class CometEventImpl implements CometEvent {
         }
         boolean iscomet = request.isComet();
         request.setComet(false);
+        request.finishRequest();
         response.finishResponse();
         if (iscomet) request.cometClose();
     }
index 9d2e2b0..6a17264 100644 (file)
@@ -314,6 +314,7 @@ public class CoyoteAdapter implements Adapter {
                 }
             }
             if (!request.isAsync() && !comet) {
+                request.finishRequest();
                 response.finishResponse();
                 req.action(ActionCode.POST_REQUEST , null);
             }
@@ -417,6 +418,7 @@ public class CoyoteAdapter implements Adapter {
             if (asyncConImpl != null) {
                 async = true;
             } else if (!comet) {
+                request.finishRequest();
                 response.finishResponse();
                 if (postParseSuccess) {
                     // Log only if processing was invoked.
index f88a774..e90055b 100644 (file)
@@ -792,10 +792,13 @@ public class Request
      * @exception IOException if an input/output error occurs
      */
     public void finishRequest() throws IOException {
-        // The reader and input stream don't need to be closed
-        // TODO: Is this ever called?
-        // If so, move input swallow disabling from 
-        // Response.finishResponse() to here
+        // Optionally disable swallowing of additional request data.
+        Context context = getContext();
+        if (context != null &&
+                response.getStatus() == HttpServletResponse.SC_REQUEST_ENTITY_TOO_LARGE &&
+                !context.getSwallowAbortedUploads()) {
+            coyoteRequest.action(ActionCode.DISABLE_SWALLOW_INPUT, null);
+        }
     }
 
 
index 26cb5ba..00eb844 100644 (file)
@@ -49,7 +49,6 @@ import org.apache.catalina.core.ApplicationSessionCookieConfig;
 import org.apache.catalina.security.SecurityUtil;
 import org.apache.catalina.util.CharsetMapper;
 import org.apache.catalina.util.DateTool;
-import org.apache.coyote.ActionCode;
 import org.apache.tomcat.util.buf.CharChunk;
 import org.apache.tomcat.util.buf.UEncoder;
 import org.apache.tomcat.util.http.FastHttpDateFormat;
@@ -498,15 +497,6 @@ public class Response
      */
     public void finishResponse() 
         throws IOException {
-        // Optionally disable swallowing of additional request data.
-        // TODO: Should be in Request.finishRequest(), but that method
-        // seems to get called never.
-        Context context = getContext();
-        if (context != null
-                && getStatus() == HttpServletResponse.SC_REQUEST_ENTITY_TOO_LARGE
-                && !context.getSwallowAbortedUploads()) {
-            coyoteResponse.action(ActionCode.DISABLE_SWALLOW_INPUT, null);
-        }
         // Writing leftover bytes
         outputBuffer.close();
     }