Commit eea379ea authored by Stefan Eissing's avatar Stefan Eissing
Browse files

Merge r1735088 from trunk:

[PATCH] mod_rewrite: double escaping of query strings in server context
(like PR50447, for server context)



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1735379 13f79535-47bb-0310-9956-ffa450edef68
parent a606cf07
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2,6 +2,10 @@

Changes with Apache 2.4.19

  *) mod_rewrite: Don't implicitly URL-escape the original query string
     when no substitution has changed it (like PR50447 but server context)
     [Evgeny Kotkov <evgeny.kotkov visualsvn.com>]

  *) mod_http2: fixes problem with wrong lifetime of file buckets on main
     connection. [Stefan Eissing]
     
+0 −6
Original line number Diff line number Diff line
@@ -112,12 +112,6 @@ RELEASE SHOWSTOPPERS:
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
  [ start all new proposals below, under PATCHES PROPOSED. ]

  *) mod_rewrite: Don't escape an unchanged query string, in server context. 
                  Was fixed in 2010 for directory context.
     trunk patch: http://svn.apache.org/r1735088
     2.4.x patch: trunk works
     +1 covener, ylavic, icing


PATCHES PROPOSED TO BACKPORT FROM TRUNK:
  [ New proposals should be added at the end of the list ]
+19 −2
Original line number Diff line number Diff line
@@ -4493,6 +4493,7 @@ static int hook_uri2file(request_rec *r)
    unsigned int port;
    int rulestatus;
    void *skipdata;
    const char *oargs;

    /*
     *  retrieve the config structures
@@ -4542,6 +4543,12 @@ static int hook_uri2file(request_rec *r)
        return DECLINED;
    }

    /*
     *  remember the original query string for later check, since we don't
     *  want to apply URL-escaping when no substitution has changed it.
     */
    oargs = r->args;

    /*
     *  add the SCRIPT_URL variable to the env. this is a bit complicated
     *  due to the fact that apache uses subrequests and internal redirects
@@ -4676,11 +4683,21 @@ static int hook_uri2file(request_rec *r)

            /* append the QUERY_STRING part */
            if (r->args) {
                char *escaped_args = NULL;
                int noescape = (rulestatus == ACTION_NOESCAPE ||
                                (oargs && !strcmp(r->args, oargs)));

                r->filename = apr_pstrcat(r->pool, r->filename, "?",
                                          (rulestatus == ACTION_NOESCAPE)
                                          noescape
                                            ? r->args
                                            : ap_escape_uri(r->pool, r->args),
                                            : (escaped_args =
                                               ap_escape_uri(r->pool, r->args)),
                                          NULL);

                rewritelog((r, 1, NULL, "%s %s to query string for redirect %s",
                            noescape ? "copying" : "escaping",
                            r->args ,
                            noescape ? "" : escaped_args));
            }

            /* determine HTTP redirect response code */