httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minf...@apache.org
Subject svn commit: r1653942 - in /httpd/test/framework/trunk/t: conf/extra.conf.in modules/alias.t
Date Thu, 22 Jan 2015 17:03:23 GMT
Author: minfrin
Date: Thu Jan 22 17:03:23 2015
New Revision: 1653942

URL: http://svn.apache.org/r1653942
Log:
mod_alias: Introduce expression parser support for Alias, ScriptAlias
and Redirect.

Modified:
    httpd/test/framework/trunk/t/conf/extra.conf.in
    httpd/test/framework/trunk/t/modules/alias.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=1653942&r1=1653941&r2=1653942&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/conf/extra.conf.in (original)
+++ httpd/test/framework/trunk/t/conf/extra.conf.in Thu Jan 22 17:03:23 2015
@@ -342,6 +342,29 @@
 
     ScriptAlias /cgi @SERVERROOT@/htdocs/modules/alias
     ScriptAliasMatch /aliascgi-(.*) @SERVERROOT@/htdocs/modules/alias/$1
+
+    <IfDefine APACHE2>
+        <IfVersion >= 2.5.0>
+            <LocationMatch /expr/ali(?<number>[0-9])>
+                Alias @SERVERROOT@/htdocs/modules/alias/%{env:MATCH_NUMBER}.html
+            </LocationMatch>
+            <LocationMatch /expr/aliascgi-(?<suffix>.*)>
+                ScriptAlias @SERVERROOT@/htdocs/modules/alias/%{env:MATCH_SUFFIX}
+            </LocationMatch>
+            <LocationMatch /expr/p(?<number>[0-9])>
+                Redirect permanent http://@SERVERNAME@:@PORT@/alias/%{env:MATCH_NUMBER}.html
+            </LocationMatch>
+            <LocationMatch /expr/t(?<number>[0-9])>
+                Redirect temp http://@SERVERNAME@:@PORT@/alias/%{env:MATCH_NUMBER}.html
+            </LocationMatch>
+            <LocationMatch /expr/s(?<number>[0-9])>
+                Redirect seeother http://@SERVERNAME@:@PORT@/alias/%{env:MATCH_NUMBER}.html
+            </LocationMatch>
+            <LocationMatch /expr/g([0-9])>
+                Redirect gone
+            </LocationMatch>
+        </IfVersion>
+    </IfDefine>
 </IfModule>
 
 Alias /manual @inherit_documentroot@/manual
@@ -944,3 +967,4 @@ LimitRequestFields    32
    </VirtualHost>
   </IfVersion>
 </IfDefine>
+

Modified: httpd/test/framework/trunk/t/modules/alias.t
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/modules/alias.t?rev=1653942&r1=1653941&r2=1653942&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/modules/alias.t (original)
+++ httpd/test/framework/trunk/t/modules/alias.t Thu Jan 22 17:03:23 2015
@@ -36,8 +36,8 @@ my %rm_rc = (
 #XXX: find something that'll on other platforms (/bin/sh aint it)
 my $script_tests = WINFU ? 0 : 4;
 
-my $tests = (keys %redirect) + (keys %rm_body) * 10 +
-            (keys %rm_rc) * 10 + 12 + $script_tests;
+my $tests = (keys %redirect) + (keys %rm_body) * (1 + have_min_apache_version("2.5")) * 10
+
+            (keys %rm_rc) * (1 + have_min_apache_version("2.5")) * 10 + have_min_apache_version("2.5")
* 11 + 12 + $script_tests;
 
 #LWP required to follow redirects
 plan tests => $tests, need need_module('alias'), need_lwp;
@@ -60,6 +60,15 @@ for (my $i=0 ; $i <= 9 ; $i++) {
              "/ali$i");
 }
 
+if (have_min_apache_version("2.5")) {
+    t_debug "verifying expression alias match with /expr/ali[0-9].";
+    for (my $i=0 ; $i <= 9 ; $i++) {
+        ok t_cmp((GET_BODY "/expr/ali$i"),
+                 $i,
+                 "/ali$i");
+    }
+}
+
 my ($actual, $expected);
 foreach (sort keys %redirect) {
     ## make LWP not follow the redirect since we
@@ -84,6 +93,19 @@ foreach (sort keys %rm_body) {
     }
 }
 
+if (have_min_apache_version("2.5")) {
+    print "verifying body of perm and temp redirect match with expression support\n";
+    foreach (sort keys %rm_body) {
+        for (my $i=0 ; $i <= 9 ; $i++) {
+            $expected = $i;
+            $actual = GET_BODY "/expr/$_$i";
+            ok t_cmp($actual,
+                     $expected,
+                     "/$_$i");
+        }
+    }
+}
+
 print "verifying return code of seeother and gone redirect match\n";
 foreach (keys %rm_rc) {
     ## make LWP not follow the redirect since we
@@ -99,6 +121,23 @@ foreach (keys %rm_rc) {
     }
 }
 
+if (have_min_apache_version("2.5")) {
+    print "verifying return code of seeother and gone redirect match with expression support\n";
+    foreach (keys %rm_rc) {
+        ## make LWP not follow the redirect since we
+        ## are just interested in the return code.
+        local $Apache::TestRequest::RedirectOK = 0;
+
+        $expected = $rm_rc{$_};
+        for (my $i=0 ; $i <= 9 ; $i++) {
+            $actual = GET_RC "/expr/$_$i";
+            ok t_cmp($actual,
+                     $expected,
+                     "$_$i");
+        }
+    }
+}
+
 ## create a little cgi to test ScriptAlias and ScriptAliasMatch ##
 my $string = "this is a shell script cgi.";
 my $cgi =<<EOF;
@@ -142,6 +181,19 @@ else {
     skip "skipping test without CGI module";
 }
 
+if (have_min_apache_version("2.5")) {
+    if (have_cgi) {
+        ## with ScriptAlias in LocationMatch ##
+        t_debug "verifying ScriptAlias in LocationMatch with /expr/aliascgi-script";
+        ok t_cmp((GET_BODY "/expr/aliascgi-script"),
+                 "$string\n",
+                 "/aliascgi-script") unless WINFU;
+    }
+    else {
+        skip "skipping test without CGI module";
+    }
+}
+
 ## failure with ScriptAliasMatch ##
 t_debug "verifying bad script alias.";
 ok t_cmp((GET_RC "/aliascgi-nada"),



Mime
View raw message