www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Buddy Lucas <bu...@wildape.com>
Subject mod_rewrite/7259: mod_rewrite does not expand variables of type ${map:key} properly
Date Fri, 16 Feb 2001 20:50:22 GMT

>Number:         7259
>Category:       mod_rewrite
>Synopsis:       mod_rewrite does not expand variables of type ${map:key} properly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Fri Feb 16 13:00:02 PST 2001
>Originator:     buddy@wildape.com
>Release:        1.3.17
Linux {myhost} 2.2.15-4mdk #1 Wed May 10 15:31:30 CEST 2000 i686 unknown
This bug disables using map expansion in mod_rewrite (e.g., in RewriteCond, 
RewriteRule etc.). The expression that should have been substituted is
returned as part of the uri. The reason for this can be found in
find_char_in_brackets(), which doesn't count the brackets correctly.
RewriteMap mymap txt:/home/httpd/maps/mymap.txt

RewriteCond ${mymap:%{HTTP_HOST}} !^root$
RewriteRule ^(.*) http://${mymap:%{HTTP_HOST}}$1 [R=301]
Small patch for me, but a large fix for mankind. ;-)

--- mod_rewrite.c.orig	Fri Feb 16 19:37:28 2001
+++ mod_rewrite.c	Fri Feb 16 21:31:20 2001
@@ -4193,7 +4193,7 @@
     int depth;
-    for (depth = 1; *s; ++s) {
+    for (depth = 0; *s; ++s) {
 	if (*s == c && depth == 1) {
 	    return s;
 [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!     ]

View raw message