Author: markt
Date: Tue Aug  9 21:22:37 2016
New Revision: 1755653

URL: http://svn.apache.org/viewvc?rev=1755653&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=59913
Correct a regression introduced with the support for the Servlet 4 
HttpServletRequest.getMapping() API that caused the attributes for forwarded 
requests to be lost if requested from within a subsequent include.

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

Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java?rev=1755653&r1=1755652&r2=1755653&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java Tue 
Aug  9 21:22:37 2016
@@ -84,6 +84,8 @@ class ApplicationHttpRequest extends Htt
       RequestDispatcher.FORWARD_QUERY_STRING,
       RequestDispatcher.FORWARD_MAPPING};
 
+    private static final int SPECIALS_FIRST_FORWARD_INDEX = 6;
+
 
     // ----------------------------------------------------------- Constructors
 
@@ -235,8 +237,9 @@ class ApplicationHttpRequest extends Htt
         if (pos == -1) {
             return getRequest().getAttribute(name);
         } else {
-            if ((specialAttributes[pos] == null)
-                && (specialAttributes[5] == null) && (pos >= 5)) {
+            if ((specialAttributes[pos] == null) &&
+                    (specialAttributes[SPECIALS_FIRST_FORWARD_INDEX] == null) 
&&
+                    (pos >= SPECIALS_FIRST_FORWARD_INDEX)) {
                 // If it's a forward special attribute, and null, it means this
                 // is an include, so we check the wrapped request since
                 // the request could have been forwarded before the include

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1755653&r1=1755652&r2=1755653&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Tue Aug  9 21:22:37 2016
@@ -112,6 +112,12 @@
         so the associated protection is now disabled when running on Java 9
         onwards. (markt)
       </fix>
+      <fix>
+        <bug>59913</bug>: Correct a regression introduced with the support for
+        the Servlet 4 <code>HttpServletRequest.getMapping()</code> API that
+        caused the attributes for forwarded requests to be lost if requested
+        from within a subsequent include. (markt)
+      </fix>
     </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