From 1221c736f9a90756d47ea6d28320b6b83602dd2a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 7 May 2024 04:04:07 +0200 Subject: Adding debian version 2.4.38-3+deb10u8. Signed-off-by: Daniel Baumann --- debian/perl-framework/t/modules/alias.t | 209 ++++++++++++++++++++++++++++++++ 1 file changed, 209 insertions(+) create mode 100644 debian/perl-framework/t/modules/alias.t (limited to 'debian/perl-framework/t/modules/alias.t') diff --git a/debian/perl-framework/t/modules/alias.t b/debian/perl-framework/t/modules/alias.t new file mode 100644 index 0000000..a605966 --- /dev/null +++ b/debian/perl-framework/t/modules/alias.t @@ -0,0 +1,209 @@ +use strict; +use warnings FATAL => 'all'; + +use Apache::Test; +use Apache::TestRequest; +use Apache::TestUtil; +use Apache::TestConfig (); + +use constant WINFU => Apache::TestConfig::WINFU(); + +## +## mod_alias test +## + +## redirect codes for Redirect testing ## +my %redirect = ( + perm => '301', + perm2 => '301', + temp => '302', + temp2 => '302', + seeother => '303', + gone => '410', + forbid => '403' +); + +## RedirectMatch testing ## +my %rm_body = ( + p => '301', + t => '302' +); + +my %rm_rc = ( + s => '303', + g => '410', + f => '403' +); + +#XXX: find something that'll on other platforms (/bin/sh aint it) +my $script_tests = WINFU ? 0 : 4 + have_min_apache_version("2.4.19"); + +my $tests = 12 + have_min_apache_version("2.4.19") * 10 + + (keys %redirect) + + (keys %rm_body) * (1 + have_min_apache_version("2.4.19")) * 10 + + (keys %rm_rc) * (1 + have_min_apache_version("2.4.19")) * 10 + + $script_tests; + +#LWP required to follow redirects +plan tests => $tests, need need_module('alias'), need_lwp; + +## simple alias ## +t_debug "verifying simple aliases"; +ok t_cmp((GET_RC "/alias/"), + 200, + "/alias/"); +## alias to a non-existant area ## +ok t_cmp((GET_RC "/bogu/"), + 404, + "/bogu/"); + + +t_debug "verifying alias match with /ali[0-9]."; +for (my $i=0 ; $i <= 9 ; $i++) { + ok t_cmp((GET_BODY "/ali$i"), + $i, + "/ali$i"); +} + +if (have_min_apache_version("2.4.19")) { + 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 + ## are just interested in the return code. + local $Apache::TestRequest::RedirectOK = 0; + + $expected = $redirect{$_}; + $actual = GET_RC "/$_"; + ok t_cmp($actual, + $expected, + "/$_"); +} + +print "verifying body of perm and temp redirect match\n"; +foreach (sort keys %rm_body) { + for (my $i=0 ; $i <= 9 ; $i++) { + $expected = $i; + $actual = GET_BODY "/$_$i"; + ok t_cmp($actual, + $expected, + "/$_$i"); + } +} + +if (have_min_apache_version("2.4.19")) { + 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 + ## 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 "$_$i"; + ok t_cmp($actual, + $expected, + "$_$i"); + } +} + +if (have_min_apache_version("2.4.19")) { + 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 =<{t_logs}/mod_cgi.log"); -- cgit v1.2.3