Author: markt Date: Mon Jun 16 13:58:57 2014 New Revision: 1602866 URL: http://svn.apache.org/r1602866 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56620 Avoid bogus access log entries when pausing the NIO HTTP connector. Ensure that any requests partially read before the connector is paused are logged in the access log with the correct start time.
Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/ ------------------------------------------------------------------------------ Merged /tomcat/trunk:r1602842,1602844,1602865 Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java?rev=1602866&r1=1602865&r2=1602866&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java Mon Jun 16 13:58:57 2014 @@ -188,15 +188,7 @@ public class Http11AprProcessor extends // (long keepalive), so that the processor should be recycled // and the method should return true openSocket = true; - if (endpoint.isPaused()) { - // 503 - Service unavailable - response.setStatus(503); - setErrorState(ErrorState.CLOSE_CLEAN, null); - getAdapter().log(request, response, 0); - } else { - return true; - } - return false; + return true; } Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java?rev=1602866&r1=1602865&r2=1602866&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java Mon Jun 16 13:58:57 2014 @@ -224,21 +224,24 @@ public class Http11NioProcessor extends socketWrapper.setTimeout(endpoint.getKeepAliveTimeout()); } } else { - // Started to read request line. Need to keep processor - // associated with socket - readComplete = false; - // Make sure poller uses soTimeout from here onwards - socketWrapper.setTimeout(endpoint.getSoTimeout()); - } - if (endpoint.isPaused()) { - // 503 - Service unavailable - response.setStatus(503); - setErrorState(ErrorState.CLOSE_CLEAN, null); - getAdapter().log(request, response, 0); - } else { - return true; + // 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); + setErrorState(ErrorState.CLOSE_CLEAN, null); + getAdapter().log(request, response, 0); + return false; + } else { + // Need to keep processor associated with socket + readComplete = false; + // Make sure poller uses soTimeout from here onwards + socketWrapper.setTimeout(endpoint.getSoTimeout()); + } } - return false; + return true; } Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1602866&r1=1602865&r2=1602866&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Mon Jun 16 13:58:57 2014 @@ -137,6 +137,10 @@ make it easier for the client to differentiate between a complete response and one that failed part way though. (markt) </fix> + <fix> + <bug>56620</bug>: Avoid bogus access log entries when pausing the NIO + HTTP connector. (markt) + </fix> </changelog> </subsection> <subsection name="Jasper"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org