Author: markt
Date: Sat Apr  7 20:03:24 2018
New Revision: 1828617

URL: http://svn.apache.org/viewvc?rev=1828617&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=62258
Don't trigger the standard error page mechanism when the error has caused the 
connection to the client to be closed as no-one will ever see the error page.

Modified:
    tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java?rev=1828617&r1=1828616&r2=1828617&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java Sat Apr  
7 20:03:24 2018
@@ -17,6 +17,7 @@
 package org.apache.catalina.core;
 
 import java.io.IOException;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.servlet.DispatcherType;
 import javax.servlet.RequestDispatcher;
@@ -31,6 +32,7 @@ import org.apache.catalina.connector.Cli
 import org.apache.catalina.connector.Request;
 import org.apache.catalina.connector.Response;
 import org.apache.catalina.valves.ValveBase;
+import org.apache.coyote.ActionCode;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.ExceptionUtils;
@@ -162,10 +164,16 @@ final class StandardHostValve extends Va
 
             // Look for (and render if found) an application level error page
             if (response.isErrorReportRequired()) {
-                if (t != null) {
-                    throwable(request, response, t);
-                } else {
-                    status(request, response);
+                // If an error has occurred that prevents further I/O, don't 
waste time
+                // producing an error report that will never be read
+                AtomicBoolean result = new AtomicBoolean(false);
+                response.getCoyoteResponse().action(ActionCode.IS_IO_ALLOWED, 
result);
+                if (result.get()) {
+                    if (t != null) {
+                        throwable(request, response, t);
+                    } else {
+                        status(request, response);
+                    }
                 }
             }
 

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1828617&r1=1828616&r2=1828617&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Sat Apr  7 20:03:24 2018
@@ -52,6 +52,11 @@
         <code>RemoteIpValve</code> processes a request for which no Context can
         be found. (markt)
       </fix>
+      <add>
+        <bug>62258</bug>: Don't trigger the standard error page mechanism when
+        the error has caused the connection to the client to be closed as 
no-one
+        will ever see the error page. (markt)
+      </add>
     </changelog>
   </subsection>
   <subsection name="Coyote">



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

Reply via email to