tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1751518 - in /tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector: Request.java ResponseFacade.java
Date Tue, 05 Jul 2016 18:28:14 GMT
Author: markt
Date: Tue Jul  5 18:28:14 2016
New Revision: 1751518

URL: http://svn.apache.org/viewvc?rev=1751518&view=rev
Log:
Align 9.0.x and 8.5.x.

Modified:
    tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Request.java
    tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/ResponseFacade.java

Modified: tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Request.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Request.java?rev=1751518&r1=1751517&r2=1751518&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Request.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Request.java Tue Jul  5 18:28:14
2016
@@ -127,11 +127,10 @@ public class Request implements org.apac
 
 
     public Request() {
-
-        formats[0].setTimeZone(GMT_ZONE);
-        formats[1].setTimeZone(GMT_ZONE);
-        formats[2].setTimeZone(GMT_ZONE);
-
+        formats = new SimpleDateFormat[formatsTemplate.length];
+        for(int i = 0; i < formats.length; i++) {
+            formats[i] = (SimpleDateFormat) formatsTemplate[i].clone();
+        }
     }
 
 
@@ -187,7 +186,9 @@ public class Request implements org.apac
      * Notice that because SimpleDateFormat is not thread-safe, we can't
      * declare formats[] as a static variable.
      */
-    protected final SimpleDateFormat formats[] = {
+    protected final SimpleDateFormat formats[];
+
+    private static final SimpleDateFormat formatsTemplate[] = {
         new SimpleDateFormat(FastHttpDateFormat.RFC1123_DATE, Locale.US),
         new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", Locale.US),
         new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US)
@@ -774,12 +775,8 @@ public class Request implements org.apac
      * @exception IOException if an input/output error occurs
      */
     public void finishRequest() throws IOException {
-        // 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);
+        if (response.getStatus() == HttpServletResponse.SC_REQUEST_ENTITY_TOO_LARGE) {
+            checkSwallowInput();
         }
     }
 
@@ -2641,7 +2638,9 @@ public class Request implements org.apac
 
 
     /**
-     * Disable swallowing of remaining input if configured
+     * Check the configuration for aborted uploads and if configured to do so,
+     * disable the swallowing of any remaining input and close the connection
+     * once the response has been written.
      */
     protected void checkSwallowInput() {
         Context context = getContext();
@@ -3491,5 +3490,9 @@ public class Request implements org.apac
                         // NO-OP
                     }
                 });
+
+        for (SimpleDateFormat sdf : formatsTemplate) {
+            sdf.setTimeZone(GMT_ZONE);
+        }
     }
 }

Modified: tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/ResponseFacade.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/ResponseFacade.java?rev=1751518&r1=1751517&r2=1751518&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/ResponseFacade.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/ResponseFacade.java Tue Jul  5
18:28:14 2016
@@ -225,23 +225,18 @@ public class ResponseFacade
         }
 
         response.setContentLength(len);
-
     }
 
 
-    /**
-     * TODO SERVLET 3.1
-     */
     @Override
     public void setContentLengthLong(long length) {
         if (isCommitted()) {
             return;
         }
-
         response.setContentLengthLong(length);
-
     }
 
+
     @Override
     public void setContentType(String type) {
 



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


Mime
View raw message