You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2016/03/15 15:59:12 UTC

svn commit: r1735090 - in /httpd/test/framework/trunk/t: conf/extra.conf.in modules/rewrite.t

Author: covener
Date: Tue Mar 15 14:59:12 2016
New Revision: 1735090

URL: http://svn.apache.org/viewvc?rev=1735090&view=rev
Log:
Tests for old PR50447 and new followup for server context.

Submitted By: Evgeny Kotkov <evgeny.kotkov visualsvn.com>
Committed By: covener


Modified:
    httpd/test/framework/trunk/t/conf/extra.conf.in
    httpd/test/framework/trunk/t/modules/rewrite.t

Modified: httpd/test/framework/trunk/t/conf/extra.conf.in
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/conf/extra.conf.in?rev=1735090&r1=1735089&r2=1735090&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/conf/extra.conf.in (original)
+++ httpd/test/framework/trunk/t/conf/extra.conf.in Tue Mar 15 14:59:12 2016
@@ -234,6 +234,9 @@
         ## Proxy and QSA
         RewriteRule ^proxy-qsa.html$ http://@SERVERNAME@:@PORT@/modules/cgi/env.pl?foo=bar [QSA,L,P]
 
+        ## Redirect, directory context
+        RewriteRule ^redirect-dir.html$ http://@SERVERNAME@:@PORT@/foobar.html [L,R=301]
+
     </Directory>
 
     ### Proxy pass-through to env.pl
@@ -243,6 +246,9 @@
     RewriteCond %{QUERY_STRING} horse=trigger
     RewriteRule ^/modules/rewrite/proxy3/(.*)$ http://@SERVERNAME@:@PORT@/modules/cgi/$1 [L,P]
 
+    ### Redirect, server context
+    RewriteRule ^/modules/rewrite/redirect.html$ http://@SERVERNAME@:@PORT@/foobar.html [L,R=301]
+
    <VirtualHost cve_2011_3368_rewrite>
       DocumentRoot @SERVERROOT@/htdocs/modules/proxy
       RewriteEngine On

Modified: httpd/test/framework/trunk/t/modules/rewrite.t
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/modules/rewrite.t?rev=1735090&r1=1735089&r2=1735090&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/modules/rewrite.t (original)
+++ httpd/test/framework/trunk/t/modules/rewrite.t Tue Mar 15 14:59:12 2016
@@ -12,10 +12,19 @@ use Apache::TestUtil;
 my @map = qw(txt rnd prg); #dbm XXX: howto determine dbm support is available?
 my @num = qw(1 2 3 4 5 6);
 my @url = qw(forbidden gone perm temp);
-my @todo = ();
+my @todo;
 my $r;
 
-plan tests => @map * @num + 11, todo => \@todo, need_module 'rewrite';
+if (!have_min_apache_version('2.5')) {
+    # PR 50447, server context
+    push @todo, 26
+}
+if (!have_min_apache_version('2.4')) {
+    # PR 50447, directory context (r1044673)
+    push @todo, 24
+}
+
+plan tests => @map * @num + 15, todo => \@todo, need_module 'rewrite';
 
 foreach (@map) {
     foreach my $n (@num) {
@@ -58,6 +67,19 @@ $r = GET_BODY("/modules/rewrite/qsa.html
 chomp $r;
 ok t_cmp($r, qr/\nQUERY_STRING = foo=bar\&baz=bee\n/s, "query-string append test");
 
+# PR 50447 (double URL-escaping of the query string)
+my $hostport = Apache::TestRequest::hostport();
+
+$r = GET("/modules/rewrite/redirect-dir.html?q=%25", redirect_ok => 0);
+ok t_cmp($r->code, 301, "per-dir redirect response code is OK");
+ok t_cmp($r->header("Location"), "http://$hostport/foobar.html?q=%25",
+         "per-dir query-string escaping is OK");
+
+$r = GET("/modules/rewrite/redirect.html?q=%25", redirect_ok => 0);
+ok t_cmp($r->code, 301, "redirect response code is OK");
+ok t_cmp($r->header("Location"), "http://$hostport/foobar.html?q=%25",
+         "query-string escaping is OK");
+
 if (have_module('mod_proxy')) {
     $r = GET_BODY("/modules/rewrite/proxy.html");
     chomp $r;