From: markt Date: Mon, 5 Sep 2011 12:09:28 +0000 (+0000) Subject: Start to align the request finish code X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=8b89e00a3d40b00bda7b76e151e72b2d1d577a59;p=tomcat7.0 Start to align the request finish code git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1165253 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/coyote/http11/Http11AprProcessor.java b/java/org/apache/coyote/http11/Http11AprProcessor.java index 3b1918182..fa6a1f1cc 100644 --- a/java/org/apache/coyote/http11/Http11AprProcessor.java +++ b/java/org/apache/coyote/http11/Http11AprProcessor.java @@ -290,15 +290,20 @@ public class Http11AprProcessor extends AbstractHttp11Processor { } // Finish the handling of the request - if (!comet && !isAsync()) { - // If we know we are closing the connection, don't drain input. - // This way uploading a 100GB file doesn't tie up the thread - // if the servlet has rejected it. - if(error) + rp.setStage(org.apache.coyote.Constants.STAGE_ENDINPUT); + + if (!isAsync() && !comet) { + if (error) { + // If we know we are closing the connection, don't drain + // input. This way uploading a 100GB file doesn't tie up the + // thread if the servlet has rejected it. inputBuffer.setSwallowInput(false); + } endRequest(); } + rp.setStage(org.apache.coyote.Constants.STAGE_ENDOUTPUT); + // If there was an error, make sure the request is counted as // and error, and update the statistics counter if (error) { @@ -336,7 +341,6 @@ public class Http11AprProcessor extends AbstractHttp11Processor { } rp.setStage(org.apache.coyote.Constants.STAGE_KEEPALIVE); - } rp.setStage(org.apache.coyote.Constants.STAGE_ENDED); diff --git a/java/org/apache/coyote/http11/Http11NioProcessor.java b/java/org/apache/coyote/http11/Http11NioProcessor.java index afdddfb60..6d68bdd2c 100644 --- a/java/org/apache/coyote/http11/Http11NioProcessor.java +++ b/java/org/apache/coyote/http11/Http11NioProcessor.java @@ -351,15 +351,20 @@ public class Http11NioProcessor extends AbstractHttp11Processor { } // Finish the handling of the request - if (!comet && !isAsync()) { - // If we know we are closing the connection, don't drain input. - // This way uploading a 100GB file doesn't tie up the thread - // if the servlet has rejected it. - if(error) + rp.setStage(org.apache.coyote.Constants.STAGE_ENDINPUT); + + if (!isAsync() && !comet) { + if(error) { + // If we know we are closing the connection, don't drain + // input. This way uploading a 100GB file doesn't tie up the + // thread if the servlet has rejected it. inputBuffer.setSwallowInput(false); + } endRequest(); } + rp.setStage(org.apache.coyote.Constants.STAGE_ENDOUTPUT); + // If there was an error, make sure the request is counted as // and error, and update the statistics counter if (error) { @@ -385,10 +390,8 @@ public class Http11NioProcessor extends AbstractHttp11Processor { break; } - rp.setStage(org.apache.coyote.Constants.STAGE_KEEPALIVE); - - }//while + } rp.setStage(org.apache.coyote.Constants.STAGE_ENDED); if (error || endpoint.isPaused()) { diff --git a/java/org/apache/coyote/http11/Http11Processor.java b/java/org/apache/coyote/http11/Http11Processor.java index 1cb445ccd..0f006ba69 100644 --- a/java/org/apache/coyote/http11/Http11Processor.java +++ b/java/org/apache/coyote/http11/Http11Processor.java @@ -284,16 +284,16 @@ public class Http11Processor extends AbstractHttp11Processor { // Finish the handling of the request rp.setStage(org.apache.coyote.Constants.STAGE_ENDINPUT); - - if(error && !isAsync()) { - // If we know we are closing the connection, don't drain - // input. This way uploading a 100GB file doesn't tie up the - // thread if the servlet has rejected it. - inputBuffer.setSwallowInput(false); - } - if (!isAsync()) + if(!isAsync() && !comet) { + if (error) { + // If we know we are closing the connection, don't drain + // input. This way uploading a 100GB file doesn't tie up the + // thread if the servlet has rejected it. + inputBuffer.setSwallowInput(false); + } endRequest(); + } rp.setStage(org.apache.coyote.Constants.STAGE_ENDOUTPUT); @@ -304,11 +304,6 @@ public class Http11Processor extends AbstractHttp11Processor { } request.updateCounters(); - rp.setStage(org.apache.coyote.Constants.STAGE_KEEPALIVE); - - // Don't reset the param - we'll see it as ended. Next request - // will reset it - // thrA.setParam(null); // Next request if (!isAsync() || error) { inputBuffer.nextRequest(); @@ -320,6 +315,8 @@ public class Http11Processor extends AbstractHttp11Processor { if (isAsync() || error || inputBuffer.lastValid == 0) { break; } + + rp.setStage(org.apache.coyote.Constants.STAGE_KEEPALIVE); } rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);