httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Evgeny Kotkov <>
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]

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

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

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.


Evgeny Kotkov

View raw message