Commit bbe5577b authored by Graham Leggett's avatar Graham Leggett
Browse files

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.
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
parent f4d07a61
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
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>]
+1 −7
Original line number Diff line number Diff line
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
+10 −1
Original line number Diff line number Diff line
@@ -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;
    }
}