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 2014/06/16 20:46:25 UTC

svn commit: r1602956 - in /tomcat/trunk: java/org/apache/coyote/http11/ webapps/docs/

Author: markt
Date: Mon Jun 16 18:46:24 2014
New Revision: 1602956

URL: http://svn.apache.org/r1602956
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56620
More general fix for incorrect request start times.

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
    tomcat/trunk/java/org/apache/coyote/http11/AbstractInputBuffer.java
    tomcat/trunk/java/org/apache/coyote/http11/AbstractNioInputBuffer.java
    tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
    tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java
    tomcat/trunk/java/org/apache/coyote/http11/InternalInputBuffer.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1602956&r1=1602955&r2=1602956&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java Mon Jun 16 18:46:24 2014
@@ -999,12 +999,6 @@ public abstract class AbstractHttp11Proc
                     response.setStatus(503);
                     setErrorState(ErrorState.CLOSE_CLEAN, null);
                 } else {
-                    // Make sure that connectors that are non-blocking during
-                    // header processing (NIO) only set the start time the first
-                    // time a request is processed.
-                    if (request.getStartTime() < 0) {
-                        request.setStartTime(System.currentTimeMillis());
-                    }
                     keptAlive = true;
                     // Set this every time in case limit has been changed via JMX
                     request.getMimeHeaders().setLimit(endpoint.getMaxHeaderCount());

Modified: tomcat/trunk/java/org/apache/coyote/http11/AbstractInputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractInputBuffer.java?rev=1602956&r1=1602955&r2=1602956&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractInputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractInputBuffer.java Mon Jun 16 18:46:24 2014
@@ -228,6 +228,10 @@ public abstract class AbstractInputBuffe
     }
 
 
+    /**
+     * Implementations are expected to call {@link Request#setStartTime(long)}
+     * as soon as the first byte is read from the request.
+     */
     public abstract boolean parseRequestLine(boolean useAvailableDataOnly)
         throws IOException;
 

Modified: tomcat/trunk/java/org/apache/coyote/http11/AbstractNioInputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractNioInputBuffer.java?rev=1602956&r1=1602955&r2=1602956&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractNioInputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractNioInputBuffer.java Mon Jun 16 18:46:24 2014
@@ -193,6 +193,11 @@ public abstract class AbstractNioInputBu
                         return false;
                     }
                 }
+                // Set the start time once we start reading data (even if it is
+                // just skipping blank lines)
+                if (request.getStartTime() < 0) {
+                    request.setStartTime(System.currentTimeMillis());
+                }
                 chr = buf[pos++];
             } while ((chr == Constants.CR) || (chr == Constants.LF));
             pos--;

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java?rev=1602956&r1=1602955&r2=1602956&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java Mon Jun 16 18:46:24 2014
@@ -227,10 +227,6 @@ public class Http11NioProcessor extends 
                 socketWrapper.setTimeout(endpoint.getKeepAliveTimeout());
             }
         } else {
-            // Started to read request line.
-            if (request.getStartTime() < 0) {
-                request.setStartTime(System.currentTimeMillis());
-            }
             if (endpoint.isPaused()) {
                 // Partially processed the request so need to respond
                 response.setStatus(503);

Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java?rev=1602956&r1=1602955&r2=1602956&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java Mon Jun 16 18:46:24 2014
@@ -140,9 +140,12 @@ public class InternalAprInputBuffer exte
                 if (!fill(true))
                     throw new EOFException(sm.getString("iib.eof.error"));
             }
-
+            // Set the start time once we start reading data (even if it is
+            // just skipping blank lines)
+            if (request.getStartTime() < 0) {
+                request.setStartTime(System.currentTimeMillis());
+            }
             chr = buf[pos++];
-
         } while ((chr == Constants.CR) || (chr == Constants.LF));
 
         pos--;

Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalInputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalInputBuffer.java?rev=1602956&r1=1602955&r2=1602956&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalInputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalInputBuffer.java Mon Jun 16 18:46:24 2014
@@ -109,9 +109,12 @@ public class InternalInputBuffer extends
                 if (!fill())
                     throw new EOFException(sm.getString("iib.eof.error"));
             }
-
+            // Set the start time once we start reading data (even if it is
+            // just skipping blank lines)
+            if (request.getStartTime() < 0) {
+                request.setStartTime(System.currentTimeMillis());
+            }
             chr = buf[pos++];
-
         } while ((chr == Constants.CR) || (chr == Constants.LF));
 
         pos--;

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1602956&r1=1602955&r2=1602956&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Mon Jun 16 18:46:24 2014
@@ -194,7 +194,8 @@
       </scode>
       <fix>
         <bug>56620</bug>: Avoid bogus access log entries when pausing the NIO
-        HTTP connector. (markt)
+        HTTP connector and ensure that access log entries generated by error
+        conditions use the correct request start time. (markt)
       </fix>
     </changelog>
   </subsection>



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