httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 45529] New: B flag in mod_rewrite RewriteRule doesn't escape & and other sim characters
Date Sun, 03 Aug 2008 15:59:55 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=45529

           Summary: B flag in mod_rewrite RewriteRule doesn't escape & and
                    other sim characters
           Product: Apache httpd-2
           Version: 2.2.9
          Platform: All
               URL: http://www.update.uu.se/~marten/test/abc/teststring
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_rewrite
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: marten_berglund@hotmail.com


In Apache 2 documentation for mod_rewrite a new B flag is supposed to not
unescape back references, see:

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriteflags

When I'm trying this on my testpage in Apache 2.2.9, Apache fails doing just
that, which the above example from mod_rewrite's documentation states that it
should. That is, C++ or C%2B%2B becomes in the querystring C++ and not C%2B%2B.
The same with a&b or a%26b which becomes a&b and not a%26b. For some characters
it works: a%23b becomes a%23b.

This is essential when making rewrite rules for the MediaWiki, which should be
able to have pagenames with & and other similar characters in it. Now if an &
character appears, it is interpreted as a variable separator in the URL. The B
flag should, according to the documentation above, take care of this problem,
but it doesn't.

Try it yourself on my test page, and change teststring in the URL below to
whatever string you like:

http://www.update.uu.se/~marten/test/abc/teststring

So you know what code you are testing against, the test page contains the
following files, a .htaccess file and an index.php file:

.htaccess:
----------
RewriteEngine On
RewriteRule ^abc/(.*)$ /~marten/test/index.php?show=$1 [B]

index.php:
----------
<?php
if ($_SERVER['SERVER_SOFTWARE'])
{
echo("_SERVER['SERVER_SOFTWARE']: " . $_SERVER['SERVER_SOFTWARE'] .
"<br><br>");
}

if ($_GET['show'])
{
echo("_GET['show']: " . $_GET['show'] . "<br>");
}

if ($_SERVER['QUERY_STRING'])
{
echo("_SERVER['QUERY_STRING']: " . $_SERVER['QUERY_STRING'] . "<br>");
}

if ($_GET['show2'])
{
echo("_GET['show2']: " . $_GET['show2'] . "<br>");
}

$test_var = "<br>Some special characters like &, % and some escaped %2B and %26
et.c. works fine in a normal PHP string variable.";
echo($test_var);
?>


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message