]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
*) mod_rewrite: Avoid looping on relative substitutions that
authorEric Covener <covener@apache.org>
Thu, 14 Jan 2016 17:08:17 +0000 (17:08 +0000)
committerEric Covener <covener@apache.org>
Thu, 14 Jan 2016 17:08:17 +0000 (17:08 +0000)
     result in the same filename we started with. PR 58854.
     [Eric Covener]

Previously, the comparison of old and new filename happened before
some prefixes might be added.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1724656 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/mappers/mod_rewrite.c

diff --git a/CHANGES b/CHANGES
index be9a9db902f89a3c67f36db1e063562e4ccd6e3a..485de4d22b3087654ac951f011dbd4ab3314b0a4 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_rewrite: Avoid looping on relative substitutions that
+     result in the same filename we started with. PR 58854.
+     [Eric Covener]
+
   *) mime.types: add common extension "m4a" for MPEG 4 Audio.
      PR 57895 [Dylan Millikin <dylan.millikin gmail.com>]
 
index d795c19a06ca6196ee98ca66ad69287aa00d4ff4..83b010470fd08b7e2695be3eb78fff29b8eabc0e 100644 (file)
@@ -5068,19 +5068,6 @@ static int hook_fixup(request_rec *r)
                 return HTTP_BAD_REQUEST;
             }
 
-            /* Check for deadlooping:
-             * At this point we KNOW that at least one rewriting
-             * rule was applied, but when the resulting URL is
-             * the same as the initial URL, we are not allowed to
-             * use the following internal redirection stuff because
-             * this would lead to a deadloop.
-             */
-            if (ofilename != NULL && strcmp(r->filename, ofilename) == 0) {
-                rewritelog((r, 1, dconf->directory, "initial URL equal rewritten"
-                            " URL: %s [IGNORING REWRITE]", r->filename));
-                return OK;
-            }
-
             tmpfilename = r->filename;
 
             /* if there is a valid base-URL then substitute
@@ -5141,6 +5128,20 @@ static int hook_fixup(request_rec *r)
                 }
             }
 
+            /* Check for deadlooping:
+             * At this point we KNOW that at least one rewriting
+             * rule was applied, but when the resulting URL is
+             * the same as the initial URL, we are not allowed to
+             * use the following internal redirection stuff because
+             * this would lead to a deadloop.
+             */
+            if (ofilename != NULL && strcmp(r->filename, ofilename) == 0) {
+                rewritelog((r, 1, dconf->directory, "initial URL equal rewritten"
+                            " URL: %s [IGNORING REWRITE]", r->filename));
+                return OK;
+            }
+
+
             /* now initiate the internal redirect */
             rewritelog((r, 1, dconf->directory, "internal redirect with %s "
                         "[INTERNAL REDIRECT]", r->filename));