You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2016/06/07 12:59:46 UTC

svn commit: r1747215 - /tomcat/tc8.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java

Author: markt
Date: Tue Jun  7 12:59:46 2016
New Revision: 1747215

URL: http://svn.apache.org/viewvc?rev=1747215&view=rev
Log:
Follow-up to r1746732
r1746732 triggered the call to Processor.endRequest() in the correct location but failed to remove the call that was in the wrong location. This meant it could be called twice leading to request corruption.

Modified:
    tomcat/tc8.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java

Modified: tomcat/tc8.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java?rev=1747215&r1=1747214&r2=1747215&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java (original)
+++ tomcat/tc8.0.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java Tue Jun  7 12:59:46 2016
@@ -97,29 +97,6 @@ public class AsyncContextImpl implements
 
     @Override
     public void fireOnComplete() {
-        // Fire the listeners
-        doFireOnComplete();
-
-        // The application doesn't know it has to stop read and/or writing until
-        // it receives the complete event so the request and response have to be
-        // closed after firing the event.
-        try {
-            // First of all ensure that any data written to the response is
-            // written to the I/O layer.
-            request.getResponse().finishResponse();
-            // Close the request and the response.
-            request.getCoyoteRequest().action(ActionCode.END_REQUEST, null);
-        } catch (Throwable t) {
-            ExceptionUtils.handleThrowable(t);
-            // Catch this here and allow async context complete to continue
-            // normally so a dispatch takes place which ensures that  the
-            // request and response objects are correctly recycled.
-            log.debug(sm.getString("asyncContextImpl.finishResponseError"), t);
-        }
-    }
-
-
-    private void doFireOnComplete() {
         List<AsyncListenerWrapper> listenersCopy = new ArrayList<>();
         listenersCopy.addAll(listeners);
 
@@ -392,9 +369,7 @@ public class AsyncContextImpl implements
             dispatch = null;
             runnable.run();
             if (!request.isAsync()) {
-                // Uses internal method since we don't want the request/response
-                // to be closed. That will be handled in the adapter.
-                doFireOnComplete();
+                fireOnComplete();
             }
         } catch (RuntimeException x) {
             // doInternalComplete(true);



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org