]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_rewrite: Handle per-location rules when r->filename is unset.
authorGraham Leggett <minfrin@apache.org>
Wed, 13 Oct 2004 17:23:12 +0000 (17:23 +0000)
committerGraham Leggett <minfrin@apache.org>
Wed, 13 Oct 2004 17:23:12 +0000 (17:23 +0000)
Previously this would segfault or simply not match as expected,
depending on the platform.
PR:
Obtained from:
Submitted by: trawick
Reviewed by: trawick, geoff, jerenkrantz

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

CHANGES
STATUS
modules/mappers/mod_rewrite.c

diff --git a/CHANGES b/CHANGES
index b403961f02ffb5f1d976cee309da6662fb4a5c7e..8413256f02f775864707291aaf7c62eecba29c46 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,9 @@
 Changes with Apache 2.0.53
 
+  *) mod_rewrite: Handle per-location rules when r->filename is unset.
+     Previously this would segfault or simply not match as expected,
+     depending on the platform.  [Jeff Trawick]
+
   *) mod_rewrite: Fix query string handling for proxied URLs. PR 14518.
      [michael teitler <michael.teitler cetelem.fr>,
       Jan Kratochvil <rcpt-dev.AT.httpd.apache.org jankratochvil.net>]
diff --git a/STATUS b/STATUS
index 4b38165c3f57000eaf061e875adf38cef720b2be..dc8b48af513fd29ae7465b3e4bb6bf5e4a797970 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -1,5 +1,5 @@
 APACHE 2.0 STATUS:                                              -*-text-*-
-Last modified at [$Date: 2004/10/13 17:12:08 $]
+Last modified at [$Date: 2004/10/13 17:23:10 $]
 
 Release:
 
@@ -138,12 +138,6 @@ PATCHES TO BACKPORT FROM 2.1
        +1: nd, jerenkrantz, minfrin
        minfrin: applied to v2.0
 
-    *) mod_rewrite: Handle per-location rules when r->filename is unset.
-       Previously this would segfault or simply not match as expected,
-       depending on the platform.
-         modules/mappers/mod_rewrite.c: r1.260
-       +1: trawick, geoff, jerenkrantz
-
     *) mod_headers: Support {...}s tag for SSL variable lookup.
        http://www.apache.org/~jorton/mod_headers-2.0-ssl.diff
        +1: jorton, trawick
index 6a5c3b38d0363b5892b89f9213ec4cd289bf9b41..42fdddb3f427c726bbc81e12102b56d4aab68857 100644 (file)
@@ -1477,9 +1477,17 @@ static int hook_fixup(request_rec *r)
      *  remember the current filename before rewriting for later check
      *  to prevent deadlooping because of internal redirects
      *  on final URL/filename which can be equal to the inital one.
+     *  also, we'll restore original r->filename if we decline this
+     *  request
      */
     ofilename = r->filename;
 
+    if (r->filename == NULL) {
+        r->filename = apr_pstrdup(r->pool, r->uri);
+        rewritelog((r, 2, "init rewrite engine with requested uri %s",
+                    r->filename));
+    }
+
     /*
      *  now apply the rules ...
      */
@@ -1631,7 +1639,7 @@ static int hook_fixup(request_rec *r)
              * use the following internal redirection stuff because
              * this would lead to a deadloop.
              */
-            if (strcmp(r->filename, ofilename) == 0) {
+            if (ofilename != NULL && strcmp(r->filename, ofilename) == 0) {
                 rewritelog(r, 1, "[per-dir %s] initial URL equal rewritten "
                            "URL: %s [IGNORING REWRITE]",
                            dconf->directory, r->filename);
@@ -1688,6 +1696,7 @@ static int hook_fixup(request_rec *r)
     else {
         rewritelog(r, 1, "[per-dir %s] pass through %s",
                    dconf->directory, r->filename);
+        r->filename = ofilename;
         return DECLINED;
     }
 }