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 2023/03/19 17:42:19 UTC

svn commit: r1908523 - /httpd/test/framework/trunk/t/modules/rewrite.t

Author: covener
Date: Sun Mar 19 17:42:19 2023
New Revision: 1908523

URL: http://svn.apache.org/viewvc?rev=1908523&view=rev
Log:
refactor recent tests

consolidate the version checks for clarity
don't test the old 403 behavior, just test the improvement when it's available
don't guard the actual execution, let it work on whatever's been pushed




Modified:
    httpd/test/framework/trunk/t/modules/rewrite.t

Modified: httpd/test/framework/trunk/t/modules/rewrite.t
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/modules/rewrite.t?rev=1908523&r1=1908522&r2=1908523&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/modules/rewrite.t (original)
+++ httpd/test/framework/trunk/t/modules/rewrite.t Sun Mar 19 17:42:19 2023
@@ -14,6 +14,9 @@ my @num = qw(1 2 3 4 5 6);
 my @url = qw(forbidden gone perm temp);
 my @todo;
 my $r;
+my $post_CVE27522 = "2.5.1"; 
+my $has_redir_escape_exception = have_min_apache_version($post_CVE27522);
+my $has_bctl_bneg = have_min_apache_version($post_CVE27522);
 
 
 my @escapes = (
@@ -30,27 +33,20 @@ my @escapes = (
     [ "/modules/rewrite/escaping/fixups/proxy/foo%20bar"     =>  403],
     [ "/modules/rewrite/escaping/fixups/proxy_ne/foo%20bar"  =>  403],
 );
-if (have_min_apache_version('2.5.1')) {
+if ($has_redir_escape_exception) {
     push(@escapes, (
         # rewrite to redir escaped by default
         [ "/modules/rewrite/escaping/redir/foo%20bar"            =>  302],
         [ "/modules/rewrite/escaping/fixups/redir/foo%20bar"     =>  302],
     ));
 }
-else {
-    push(@escapes, (
-        # rewrite to redir forbidden by default
-        [ "/modules/rewrite/escaping/redir/foo%20bar"            =>  403],
-        [ "/modules/rewrite/escaping/fixups/redir/foo%20bar"     =>  403],
-    ));
-}
 
 my @bflags = (
     # t/conf/extra.conf.in
     [ "/modules/rewrite/escaping/local_b/foo/bar/%20baz%0d"               =>  "foo%2fbar%2f+baz%0d"],    # this is why [B] sucks
     [ "/modules/rewrite/escaping/local_b_justslash/foo/bar/%20baz/"       =>  "foo%2fbar%2f baz%2f"],    # test basic B=/
 );
-if (have_min_apache_version('2.5.1')) {
+if ($has_bctl_bneg) {
     # [BCTLS] / [BNE]
     push(@bflags, (
         [ "/modules/rewrite/escaping/local_bctls/foo/bar/%20baz/%0d"          =>  "foo/bar/+baz/%0d"],       # spaces and ctls only
@@ -233,23 +229,19 @@ if (have_min_apache_version("2.4.47")) {
 }
 
 
-if (have_min_apache_version("2.4.57")) {
-    foreach my $t (@escapes) {
-        my $url= $t->[0];
-        my $expect = $t->[1];
-        t_debug "Check $url for $expect\n";
-        $r = GET($url, redirect_ok => 0);
-        ok t_cmp $r->code, $expect;
-    }
-    foreach my $t (@bflags) {
-        my $url= $t->[0];
-        my $expect= $t->[1];
-        t_debug "Check $url for $expect\n";
-        $r = GET($url, redirect_ok => 0);
-        t_debug("rewritten query '" . $r->header("rewritten-query") . "'");
-        ok t_cmp $r->header("rewritten-query"), $expect;
-    }
-
+foreach my $t (@escapes) {
+    my $url= $t->[0];
+    my $expect = $t->[1];
+    t_debug "Check $url for $expect\n";
+    $r = GET($url, redirect_ok => 0);
+    ok t_cmp $r->code, $expect;
+}
+foreach my $t (@bflags) {
+    my $url= $t->[0];
+    my $expect= $t->[1];
+    t_debug "Check $url for $expect\n";
+    $r = GET($url, redirect_ok => 0);
+    t_debug("rewritten query '" . $r->header("rewritten-query") . "'");
+    ok t_cmp $r->header("rewritten-query"), $expect;
 }
 
-