Author: rjung Date: Sun Sep 25 21:48:25 2011 New Revision: 1175590 URL: http://svn.apache.org/viewvc?rev=1175590&view=rev Log: Add 503 return in process() when endpoint is paused. This is consistent with BIO and NIO. Some more whitespace and other non-functional changes to align with AjpNioProcessor.
Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java?rev=1175590&r1=1175589&r2=1175590&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Sun Sep 25 21:48:25 2011 @@ -120,7 +120,6 @@ public class AjpAprProcessor extends Abs boolean keptAlive = false; while (!error && !endpoint.isPaused()) { - // Parsing the request header try { // Get first message of the request @@ -152,7 +151,6 @@ public class AjpAprProcessor extends Abs error = true; break; } - keptAlive = true; request.setStartTime(System.currentTimeMillis()); } catch (IOException e) { @@ -182,6 +180,13 @@ public class AjpAprProcessor extends Abs } } + if (endpoint.isPaused()) { + // 503 - Service unavailable + response.setStatus(503); + adapter.log(request, response, 0); + error = true; + } + // Process the request in the adapter if (!error) { try { @@ -225,13 +230,15 @@ public class AjpAprProcessor extends Abs } rp.setStage(org.apache.coyote.Constants.STAGE_ENDED); - - if (error || endpoint.isPaused()) { - return SocketState.CLOSED; - } else if (isAsync()) { - return SocketState.LONG; + + if (!error && !endpoint.isPaused()) { + if (isAsync()) { + return SocketState.LONG; + } else { + return SocketState.OPEN; + } } else { - return SocketState.OPEN; + return SocketState.CLOSED; } } @@ -254,7 +261,7 @@ public class AjpAprProcessor extends Abs SocketStatus.OPEN); } } else if (actionCode == ActionCode.ASYNC_SETTIMEOUT) { - if (param==null) return; + if (param == null) return; long timeout = ((Long)param).longValue(); socket.setTimeout(timeout); } else if (actionCode == ActionCode.ASYNC_DISPATCH) { @@ -263,8 +270,6 @@ public class AjpAprProcessor extends Abs SocketStatus.OPEN); } } - - } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org