httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cove...@apache.org
Subject svn commit: r1724656 - in /httpd/httpd/trunk: CHANGES modules/mappers/mod_rewrite.c
Date Thu, 14 Jan 2016 17:08:17 GMT
Author: covener
Date: Thu Jan 14 17:08:17 2016
New Revision: 1724656

URL: http://svn.apache.org/viewvc?rev=1724656&view=rev
Log:
  *) mod_rewrite: Avoid looping on relative substitutions that
     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.


Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/mappers/mod_rewrite.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1724656&r1=1724655&r2=1724656&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Thu Jan 14 17:08:17 2016
@@ -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>]
 

Modified: httpd/httpd/trunk/modules/mappers/mod_rewrite.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_rewrite.c?rev=1724656&r1=1724655&r2=1724656&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Thu Jan 14 17:08:17 2016
@@ -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));



Mime
View raw message