[tomcat] branch 8.5.x updated: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=62258

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[tomcat] branch 8.5.x updated: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=62258

markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
     new 06480c7  Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=62258
06480c7 is described below

commit 06480c7c1b20dc0a581729dfc4a247c4af6ddfc5
Author: Mark Thomas <[hidden email]>
AuthorDate: Tue Aug 13 16:48:06 2019 +0100

    Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=62258
   
    Back-porting the error handling changes means this fix needs to be
    back-ported as well.
---
 java/org/apache/catalina/core/StandardHostValve.java | 16 ++++++++++++----
 webapps/docs/changelog.xml                           |  5 +++++
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/catalina/core/StandardHostValve.java b/java/org/apache/catalina/core/StandardHostValve.java
index cb24526..c713652 100644
--- a/java/org/apache/catalina/core/StandardHostValve.java
+++ b/java/org/apache/catalina/core/StandardHostValve.java
@@ -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.ClientAbortException;
 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 ValveBase {
 
             // 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);
+                    }
                 }
             }
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 0839a76..bfcdbab 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -47,6 +47,11 @@
 <section name="Tomcat 8.5.44 (markt)" rtext="in development">
   <subsection name="Catalina">
     <changelog>
+      <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>
       <update>
         <bug>63627</bug>: Implement more fine-grained handling in
         <code>RealmBase.authenticate(GSSContext, boolean)</code>. (michaelo)


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]