Author: markt Date: Fri Aug 12 07:46:23 2016 New Revision: 1756091 URL: http://svn.apache.org/viewvc?rev=1756091&view=rev Log: Align ActionCode.DISABLE_SWALLOW_INPUT
Modified: tomcat/trunk/java/org/apache/coyote/ErrorState.java tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java tomcat/trunk/java/org/apache/coyote/http2/StreamProcessor.java Modified: tomcat/trunk/java/org/apache/coyote/ErrorState.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ErrorState.java?rev=1756091&r1=1756090&r2=1756091&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/ErrorState.java (original) +++ tomcat/trunk/java/org/apache/coyote/ErrorState.java Fri Aug 12 07:46:23 2016 @@ -27,7 +27,8 @@ public enum ErrorState { * The current request/response is in an error state and while it is safe to * complete the current response it is not safe to continue to use the * existing connection which must be closed once the response has been - * completed. + * completed. For multiplexed protocols, the channel must be closed when the + * current request/response completes but the connection may continue. */ CLOSE_CLEAN(true, 1, true, true), Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?rev=1756091&r1=1756090&r2=1756091&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Fri Aug 12 07:46:23 2016 @@ -413,8 +413,10 @@ public class AjpProcessor extends Abstra break; } case DISABLE_SWALLOW_INPUT: { - // TODO: Do not swallow request input but - // make sure we are closing the connection + // Aborted upload or similar. + // No point reading the remainder of the request. + disableSwallowRequest(); + // This is an error state. Make sure it is marked as such. setErrorState(ErrorState.CLOSE_CLEAN, null); break; } @@ -1473,6 +1475,15 @@ public class AjpProcessor extends Abstra } + private void disableSwallowRequest() { + /* NO-OP + * With AJP, Tomcat controls when the client sends request body data. At + * most there will be a single packet to read and that will be handled + * in finishResponse(). + */ + } + + /** * Read at least the specified amount of bytes, and place them * in the input buffer. Note that if any data is available to read then this Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java?rev=1756091&r1=1756090&r2=1756091&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java (original) +++ tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java Fri Aug 12 07:46:23 2016 @@ -706,10 +706,11 @@ public class Http11Processor extends Abs break; } case DISABLE_SWALLOW_INPUT: { - // Do not swallow request input and make sure we are closing the - // connection + // Aborted upload or similar. + // No point reading the remainder of the request. + disableSwallowRequest(); + // This is an error state. Make sure it is marked as such. setErrorState(ErrorState.CLOSE_CLEAN, null); - inputBuffer.setSwallowInput(false); break; } @@ -1821,6 +1822,11 @@ public class Http11Processor extends Abs } + private void disableSwallowRequest() { + inputBuffer.setSwallowInput(false); + } + + /** * Checks to see if the keep-alive loop should be broken, performing any * processing (e.g. sendfile handling) that may have an impact on whether Modified: tomcat/trunk/java/org/apache/coyote/http2/StreamProcessor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/StreamProcessor.java?rev=1756091&r1=1756090&r2=1756091&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http2/StreamProcessor.java (original) +++ tomcat/trunk/java/org/apache/coyote/http2/StreamProcessor.java Fri Aug 12 07:46:23 2016 @@ -160,9 +160,11 @@ public class StreamProcessor extends Abs break; } case DISABLE_SWALLOW_INPUT: { - // NO-OP - // HTTP/2 has to swallow any input received to ensure that the flow - // control windows are correctly tracked. + // Aborted upload or similar. + // No point reading the remainder of the request. + disableSwallowRequest(); + // This is an error state. Make sure it is marked as such. + setErrorState(ErrorState.CLOSE_CLEAN, null); break; } @@ -412,6 +414,13 @@ public class StreamProcessor extends Abs } + private void disableSwallowRequest() { + // NO-OP + // HTTP/2 has to swallow any input received to ensure that the flow + // control windows are correctly tracked. + } + + @Override public void recycle() { // StreamProcessor instances are not re-used. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org