Sophie

Sophie

distrib > Mandriva > 2009.0 > i586 > by-pkgid > caf339018a6654e52c7cc23d1db11db5 > files > 46

apache-2.2.9-12.9mdv2009.0.src.rpm


 http://svn.apache.org/viewvc?view=rev&revision=790914

--- modules/mappers/mod_rewrite.c	2009-07-07 23:42:10.000000000 +0200
+++ modules/mappers/mod_rewrite.c.oden	2009-07-07 23:44:14.000000000 +0200
@@ -3858,7 +3858,20 @@ static int apply_rewrite_rule(rewriterul
      * ourself).
      */
     if (p->flags & RULEFLAG_PROXY) {
-	/* PR#39746: Escaping things here gets repeated in mod_proxy */
+       /* For rules evaluated in server context, the mod_proxy fixup
+        * hook can be relied upon to escape the URI as and when
+        * necessary, since it occurs later.  If in directory context,
+        * the ordering of the fixup hooks is forced such that
+        * mod_proxy comes first, so the URI must be escaped here
+        * instead.  See PR 39746, 46428, and other headaches. */
+       if (ctx->perdir && (p->flags & RULEFLAG_NOESCAPE) == 0) {
+           char *old_filename = r->filename;
+
+           r->filename = ap_escape_uri(r->pool, r->filename);
+           rewritelog((r, 2, ctx->perdir, "escaped URI in per-dir context "
+                       "for proxy, %s -> %s", old_filename, r->filename));
+       }
+
         fully_qualify_uri(r);
 
         rewritelog((r, 2, ctx->perdir, "forcing proxy-throughput with %s",