www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abag...@apache.org
Subject Re: mod_alias/7503: PATCH: RedirectMatch is inconsistent with Redirect
Date Sun, 06 May 2001 19:35:02 GMT
[In order for any reply to be added to the PR database, you need]
[to include <apbugs@Apache.Org> in the Cc line and make sure the]
[subject line starts with the report component and number, with ]
[or without any 'Re:' prefixes (such as "general/1098:" or      ]
["Re: general/1098:").  If the subject doesn't match this       ]
[pattern, your message will be misfiled and ignored.  The       ]
["apbugs" address is not added to the Cc line of messages from  ]
[the database automatically because of the potential for mail   ]
[loops.  If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request from a  ]
[developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]


Synopsis: PATCH: RedirectMatch is inconsistent with Redirect

State-Changed-From-To: open-feedback
State-Changed-By: abagchi
State-Changed-When: Sun May  6 12:35:01 PDT 2001
State-Changed-Why:
We can't just remove the escaping, because it is possible
to redirect to a file with a space in it.  If we don't
escape the URI, then we will redirect to an invalid URL.
The problem is that we are escaping too much.  Currently we escape the URI and the QUERY_STRING.

I am attaching a patch that solves this problem, while maintaining the ability to redirect
to a URL with spaces.  This patch is against 2.0, but it should also apply to 1.3.  Please
test this and let me know if it works for you.

Index: modules/mappers/mod_alias.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_alias.c,v
retrieving revision 1.27
diff -u -d -b -w -u -r1.27 mod_alias.c
--- modules/mappers/mod_alias.c 2001/02/18 02:58:52     1.27
+++ modules/mappers/mod_alias.c 2001/05/06 19:16:26
@@ -335,7 +335,10 @@
                    found = ap_pregsub(r->pool, p->real, r->uri,
                                    p->regexp->re_nsub + 1, regm);
                    if (found && doesc) {
-                       found = ap_escape_uri(r->pool, found);
+                        uri_components uri;
+                        ap_parse_uri_components(r->pool, found, &uri);
+                       found = ap_escape_uri(r->pool, uri.path);
+                        found = apr_pstrcat(r->pool, found, "?", uri.query, NULL);
                    }
                }
                else {


Mime
View raw message