@@ -800,6 +800,9 @@ public ServletInputStream createInputStream()
800800 */
801801 public void finishRequest () throws IOException {
802802 // The reader and input stream don't need to be closed
803+ // TODO: Is this ever called?
804+ // If so, move input swallow disabling from
805+ // Response.finishResponse() to here
803806 }
804807
805808
@@ -2450,6 +2453,16 @@ public boolean getAvailable() {
24502453 return (inputBuffer .available () > 0 );
24512454 }
24522455
2456+ /**
2457+ * Disable swallowing of remaining input if configured
2458+ */
2459+ protected void disableSwallowInput () {
2460+ Context context = getContext ();
2461+ if (context != null && !context .getSwallowAbortedUploads ()) {
2462+ coyoteRequest .action (ActionCode .DISABLE_SWALLOW_INPUT , null );
2463+ }
2464+ }
2465+
24532466 public void cometClose () {
24542467 coyoteRequest .action (ActionCode .COMET_CLOSE ,getEvent ());
24552468 }
@@ -2620,6 +2633,7 @@ private void parseParts() {
26202633 } catch (InvalidContentTypeException e ) {
26212634 partsParseException = new ServletException (e );
26222635 } catch (FileUploadBase .SizeException e ) {
2636+ disableSwallowInput ();
26232637 partsParseException = new IllegalStateException (e );
26242638 } catch (FileUploadException e ) {
26252639 partsParseException = new IOException (e );
@@ -2845,6 +2859,7 @@ protected void parseParameters() {
28452859 context .getLogger ().debug (
28462860 sm .getString ("coyoteRequest.postTooLarge" ));
28472861 }
2862+ disableSwallowInput ();
28482863 return ;
28492864 }
28502865 byte [] formData = null ;
@@ -2922,6 +2937,7 @@ protected byte[] readChunkedPostBody() throws IOException {
29222937 if (connector .getMaxPostSize () > 0 &&
29232938 (body .getLength () + len ) > connector .getMaxPostSize ()) {
29242939 // Too much data
2940+ disableSwallowInput ();
29252941 throw new IllegalArgumentException (
29262942 sm .getString ("coyoteRequest.chunkedPostTooLarge" ));
29272943 }
0 commit comments