httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jaillet...@apache.org
Subject svn commit: r1845094 - /httpd/test/framework/trunk/t/modules/setenvif.t
Date Mon, 29 Oct 2018 09:54:49 GMT
Author: jailletc36
Date: Mon Oct 29 09:54:48 2018
New Revision: 1845094

URL: http://svn.apache.org/viewvc?rev=1845094&view=rev
Log:
Add test against 'SetEnvIfExpr'

The last one is related to a corner case fixed in r1786235 (not yet in 2.4.x, but to be proposed
soon).
Without the fix, we get a Internal Server Error.

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

Modified: httpd/test/framework/trunk/t/modules/setenvif.t
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/modules/setenvif.t?rev=1845094&r1=1845093&r2=1845094&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/modules/setenvif.t (original)
+++ httpd/test/framework/trunk/t/modules/setenvif.t Mon Oct 29 09:54:48 2018
@@ -3,9 +3,11 @@ use warnings FATAL => 'all';
 
 use Apache::Test;
 use Apache::TestRequest;
+use Apache::TestUtil;
 
 my $vars = Apache::Test::vars();
 my $htdocs = Apache::Test::vars('documentroot');
+my $body;
 
 ##
 ## mod_setenvif tests
@@ -54,7 +56,7 @@ my @var = qw(VAR_ONE VAR_TWO VAR_THREE);
 
 my $htaccess = "$htdocs/modules/setenvif/htaccess/.htaccess";
 
-plan tests => @var * 8 + (keys %var_att) * 6 * @var,
+plan tests => @var * 10 + (keys %var_att) * 6 * @var + 4,
     have_module qw(setenvif include);
 
 sub write_htaccess {
@@ -147,6 +149,28 @@ test_all_vars(1,"BrowserMatch $good_ua R
 test_all_vars(1,
     "BrowserMatch $good_ua RELAY=1\nSetEnvIf RELAY 1 R2=1\nSetEnvIf RELAY 1 !R2\nSetEnvIf
R2 1");
 
+## test SetEnvIfExpr ##
+test_all_vars(0, "SetEnvIfExpr \"%{REQUEST_URI} =~ /\.shtml\$/\"");
+test_all_vars(1, "SetEnvIfExpr \"%{REQUEST_URI} =~ /\.foo\$/\"");
+
+## test SetEnvIfExpr with replacement ##
+write_htaccess("SetEnvIfExpr \"%{REQUEST_URI} =~ /\.\(sh\)tml\$/\" VAR_ONE=\$0 VAR_TWO=\$1");
+$body = GET_BODY $page;
+ok t_cmp($body, "1:.shtml\n2:sh\n3:(none)\n");
+
+write_htaccess("SetEnvIfExpr \"%{REQUEST_URI} !~ /\.\(sh\)tml\$/\" VAR_ONE=\$0 VAR_TWO=\$1");
+$body = GET_BODY $page;
+ok t_cmp($body, "1:(none)\n2:(none)\n3:(none)\n");
+
+## test SetEnvIfExpr with replacement when regex does NOT match ##
+write_htaccess("SetEnvIfExpr \"%{REQUEST_URI} =~ /\.\(sh\)tmlXXX\$/\" VAR_ONE=\$0 VAR_TWO=\$1");
+$body = GET_BODY $page;
+ok t_cmp($body, "1:(none)\n2:(none)\n3:(none)\n");
+
+## test SetEnvIfExpr with replacement when regex is REQUIRED to NOT match ##
+write_htaccess("SetEnvIfExpr \"%{REQUEST_URI} !~ /\.\(sh\)tmlXXX\$/\" VAR_ONE=\$0 VAR_TWO=\$1");
+$body = GET_BODY $page;
+ok t_cmp($body, "1:\$0\n2:\$1\n3:(none)\n");
 
 ## i think this should work, but it doesnt.
 ## leaving it commented now pending investigation.



Mime
View raw message