summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorEric Covener <covener@apache.org>2010-12-11 16:14:06 +0000
committerEric Covener <covener@apache.org>2010-12-11 16:14:06 +0000
commitfce013d2343fce6e1bbd53e094fe883caf1225bd (patch)
treefada7060998b4ffb9b1697a16d7c5049fc658650 /modules
parentfc8954db36a33e889fa4ab988d7a993032ab9adf (diff)
downloadhttpd-fce013d2343fce6e1bbd53e094fe883caf1225bd.tar.gz
PR 50447: mod_rewrite escapes the original [escaped] query string even when
you haven't modified it. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1044673 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules')
-rw-r--r--modules/mappers/mod_rewrite.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c
index 431e5fa8d5..44ff0b46cc 100644
--- a/modules/mappers/mod_rewrite.c
+++ b/modules/mappers/mod_rewrite.c
@@ -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 */