On Apr 21, 2008, at 08:54, Aleksander Budzynowski wrote:
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?
This does look pretty nasty. Can you try 1) testing with the latest
versions, and 2) posting your RewriteLog so that we can see what
process it's going through to do this? Given that that's an example
from the documentation, one kind of hopes that it'll work correctly.
Also, I'm trying this out myself. Is it only on PATH_INFO, or is it
also on existing file names?
--Rich
--
Just because your voice reaches halfway around the world doesn't mean
you are wiser than when it reached only to the end of the bar.
Edward R. Murrow