Blob Blame History Raw
--- java/org/apache/catalina/servlets/DefaultServlet.java.orig	2017-06-08 16:12:18.426412964 -0400
+++ java/org/apache/catalina/servlets/DefaultServlet.java	2017-06-08 16:12:18.436413002 -0400
@@ -245,7 +245,7 @@
         urlEncoder.addSafeCharacter('.');
         urlEncoder.addSafeCharacter('*');
         urlEncoder.addSafeCharacter('/');
-        
+
         if (Globals.IS_SECURITY_ENABLED) {
             factory = DocumentBuilderFactory.newInstance();
             factory.setNamespaceAware(true);
@@ -423,6 +423,18 @@
     }
 
 
+    @Override
+    protected void service(HttpServletRequest req, HttpServletResponse resp)
+            throws ServletException, IOException {
+
+        if (req.getDispatcherType() == DispatcherType.ERROR) {
+            doGet(req, resp);
+        } else {
+            super.service(req, resp);
+        }
+    }
+
+
     /**
      * Process a GET request for the specified resource.
      *
@@ -860,8 +872,7 @@
             }
         }
 
-        boolean isError =
-            response.getStatus() >= HttpServletResponse.SC_BAD_REQUEST;
+        boolean isError = DispatcherType.ERROR == request.getDispatcherType();
 
         // Check if the conditions specified in the optional If headers are
         // satisfied.
@@ -1326,7 +1337,7 @@
 
     }
 
-    
+
     /**
      * Return an InputStream to an HTML representation of the contents
      * of this directory.
@@ -1767,15 +1778,15 @@
 
 
     private File validateGlobalXsltFile() {
-        
+
         File result = null;
         String base = System.getProperty(Globals.CATALINA_BASE_PROP);
-        
+
         if (base != null) {
             File baseConf = new File(base, "conf");
             result = validateGlobalXsltFile(baseConf);
         }
-        
+
         if (result == null) {
             String home = System.getProperty(Globals.CATALINA_HOME_PROP);
             if (home != null && !home.equals(base)) {
@@ -2364,6 +2375,8 @@
 
         /**
          * Validate range.
+         *
+         * @return true if the range is valid, otherwise false
          */
         public boolean validate() {
             if (end >= length)
--- java/org/apache/catalina/servlets/WebdavServlet.java.orig	2017-06-08 16:12:18.427412968 -0400
+++ java/org/apache/catalina/servlets/WebdavServlet.java	2017-06-08 16:12:18.436413002 -0400
@@ -40,6 +40,7 @@
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.DirContext;
+import javax.servlet.DispatcherType;
 import javax.servlet.RequestDispatcher;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
@@ -354,6 +355,11 @@
             return;
         }
 
+        if (req.getDispatcherType() == DispatcherType.ERROR) {
+            doGet(req, resp);
+            return;
+        }
+
         final String method = req.getMethod();
 
         if (debug > 0) {
--- webapps/docs/changelog.xml.orig	2017-06-08 16:12:18.429412975 -0400
+++ webapps/docs/changelog.xml	2017-06-08 16:13:17.452638065 -0400
@@ -57,6 +57,23 @@
   They eventually become mixed with the numbered issues. (I.e., numbered
   issues do not "pop up" wrt. others).
 -->
+<section name="Tomcat 7.0.76-2 (csutherl)">
+  <subsection name="Catalina">
+    <changelog>
+      <fix>
+        Use a more reliable mechanism for the <code>DefaultServlet</code> when
+        determining if the current request is for custom error page or not.
+        (markt)
+      </fix>
+      <fix>
+        Ensure that when the Default or WebDAV servlets process an error
+        dispatch that the error resource is processed via the
+        <code>doGet()</code> method irrespective of the method used for the
+        original request that triggered the error. (markt)
+      </fix>
+    </changelog>
+  </subsection>
+</section>
 <section name="Tomcat 7.0.76 (violetagg)">
   <subsection name="Catalina">
     <changelog>