httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cove...@apache.org
Subject svn commit: r1044673 - in /httpd/httpd/trunk: CHANGES modules/mappers/mod_rewrite.c
Date Sat, 11 Dec 2010 16:14:07 GMT
Author: covener
Date: Sat Dec 11 16:14:06 2010
New Revision: 1044673

URL: http://svn.apache.org/viewvc?rev=1044673&view=rev
Log:
PR 50447: mod_rewrite escapes the original [escaped] query string even when
you haven't modified it.

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=1044673&r1=1044672&r2=1044673&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Dec 11 16:14:06 2010
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.3.10
 
+  *) mod_rewrite: Don't implicitly URL-escape the original query string
+     when no substitution has changed it. PR 50447. [Eric Covener]
+
   *) core: Honor 'AcceptPathInfo OFF' during internal redirects,
      such as per-directory mod_rewrite substitutions.  PR 50349.
      [Eric Covener]

Modified: httpd/httpd/trunk/modules/mappers/mod_rewrite.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_rewrite.c?rev=1044673&r1=1044672&r2=1044673&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Sat Dec 11 16:14:06 2010
@@ -4636,7 +4636,7 @@ static int hook_fixup(request_rec *r)
     apr_size_t l;
     int rulestatus;
     int n;
-    char *ofilename;
+    char *ofilename, *oargs;
     int is_proxyreq;
     void *skipdata;
 
@@ -4710,6 +4710,7 @@ static int hook_fixup(request_rec *r)
      *  request
      */
     ofilename = r->filename;
+    oargs = r->args;
 
     if (r->filename == NULL) {
         r->filename = apr_pstrdup(r->pool, r->uri);
@@ -4814,11 +4815,20 @@ static int hook_fixup(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, dconf->directory, "%s %s to query string for redirect
%s",
+                            noescape ? "copying" : "escaping",  
+                            r->args , 
+                            noescape ? "" : escaped_args));
             }
 
             /* determine HTTP redirect response code */



Mime
View raw message