]> granicus.if.org Git - apache/commitdiff
revert broken r1724656 which moved the rewrite loop checks
authorEric Covener <covener@apache.org>
Mon, 29 Feb 2016 13:48:50 +0000 (13:48 +0000)
committerEric Covener <covener@apache.org>
Mon, 29 Feb 2016 13:48:50 +0000 (13:48 +0000)
until after bases had been stripped and added in prep
for internal redirect.

original issue & regression disussed in PR58854

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

modules/mappers/mod_rewrite.c

index 1fb4d163f91a2c2917235b1efe1d439cc1b93865..f82b4b20c97f891535f4e2df430ff49e6fef238f 100644 (file)
@@ -5067,6 +5067,19 @@ 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
@@ -5127,20 +5140,6 @@ 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));