Author: markt Date: Mon Jun 16 13:55:50 2014 New Revision: 1602865 URL: http://svn.apache.org/r1602865 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/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java?rev=1602865&r1=1602864&r2=1602865&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java Mon Jun 16 13:55:50 2014 @@ -175,13 +175,6 @@ 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); - return false; - } return true; } Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java?rev=1602865&r1=1602864&r2=1602865&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11Nio2Processor.java Mon Jun 16 13:55:50 2014 @@ -230,18 +230,22 @@ public class Http11Nio2Processor 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); - return false; + // 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 true; } 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=1602865&r1=1602864&r2=1602865&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java Mon Jun 16 13:55:50 2014 @@ -227,18 +227,22 @@ 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); - return false; + // 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 true; } Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1602865&r1=1602864&r2=1602865&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Mon Jun 16 13:55:50 2014 @@ -192,6 +192,10 @@ <scode> Remove the beta tag from the NIO2 connectors. (remm) </scode> + <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