httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Evgeny Kotkov <evgeny.kot...@visualsvn.com>
Subject [PATCH] mod_rewrite: double escaping of query strings in server context
Date Tue, 15 Mar 2016 11:22:43 GMT
This patch fixes a problem in mod_rewrite.  The following config with the
RewriteRule in per-directory context works fine for query strings:

    <Directory "/">
        RewriteEngine  On
        RewriteRule  ^foo  http://hostname/bar  [R=301,L]
    </Directory>

But the same RewriteRule in per-server context doesn't work:

    <VirtualHost *:80>
        RewriteEngine  On
        RewriteRule  ^/foo  http://hostname/bar  [R=301,L]
    </VirtualHost>

The second example leads to double URL-escaping of the query string:

    GET /foo?q=%25
    301 Moved Permanently
    Location: http://hostname/bar?q=%25%25

This is PR 50447 [1], and the issue was fixed for per-directory contexts in
r1044673 [2].  However, RewriteRules in server context are handled differently
in mod_rewrite, and their handling wasn't updated.  The attached patch applies
the same fix for such rules.  The second patch adds a regression test for the
issue in t/modules/rewrite.t.  Both of the patches are against trunk.

[1] https://bz.apache.org/bugzilla/show_bug.cgi?id=50447
[2] https://svn.apache.org/r1044673


Regards,
Evgeny Kotkov

Mime
View raw message