mod_rewrite: PATH_INFO gets injected with each Rule

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux