Hi,

The behaviour I'm seeing resemebles the bug described here:
http://archive.apache.org/gnats/7879 Reportedly it was fixed in
2.0.30.However, testing under both 2.2.3 and 2.0.61 I get the same
sort of problem.

Essentially, PATH_INFO is appended to the end of the URI before each
RewriteRule is processed. If more than one RewriteRule match, you can end up
with redundant garbage at the end of the URI.

Let's consider a rule designed to turn all underscores into hyphens (done in
a per-directory context, i.e. .htaccess file):

RewriteEngine On
#Convert _ to - (N flag ensures that all underscores get converted)
RewriteRule ^(.*)_(.*) $1-$2 [N]

It seems innocent enough. But issue a request for

/_f_o_o_/bar

(where _f_o_o_ does not exist, placing '/bar' in PATH_INFO), and this gets
rewritten to /-f-o-o-/bar/bar/bar/bar!

If you request /foo/_bar (assuming foo does not exist), then each new _bar
will feed an extra underscore back into the mix, creating an infinite loop -
even worse.


In the RewriteLog, one sees something like this before the application of
each RewriteRule:

add path-info postfix: /rewritebase/_f_o_o_ -> /rewritebase/_f_o_o_/bar

although each time it accumulates an extra '/bar'.


This doesn't look right to me. Is it a bug? Or have I missed something
obvious?

Thanks,

Aleks

Reply via email to