summaryrefslogtreecommitdiffstats
path: root/debian/perl-framework/t/apache/acceptpathinfo.t
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-07 02:04:07 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-07 02:04:07 +0000
commit1221c736f9a90756d47ea6d28320b6b83602dd2a (patch)
treeb453ba7b1393205258c9b098a773b4330984672f /debian/perl-framework/t/apache/acceptpathinfo.t
parentAdding upstream version 2.4.38. (diff)
downloadapache2-debian.tar.xz
apache2-debian.zip
Adding debian version 2.4.38-3+deb10u8.debian/2.4.38-3+deb10u8debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/perl-framework/t/apache/acceptpathinfo.t')
-rw-r--r--debian/perl-framework/t/apache/acceptpathinfo.t86
1 files changed, 86 insertions, 0 deletions
diff --git a/debian/perl-framework/t/apache/acceptpathinfo.t b/debian/perl-framework/t/apache/acceptpathinfo.t
new file mode 100644
index 0000000..b42093c
--- /dev/null
+++ b/debian/perl-framework/t/apache/acceptpathinfo.t
@@ -0,0 +1,86 @@
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestRequest;
+use Apache::TestUtil;
+
+my $havecgi = have_cgi();
+
+my $pathinfo = "/foo/bar";
+
+##
+## mode path, filerc, filebody, cgirc, cgibody
+##
+my %tests = (
+ default => [ "", "404","Not Found", "200","_${pathinfo}_" ],
+ on => [ "/on", "200","_${pathinfo}_","200","_${pathinfo}_" ],
+ off => [ "/off","404","Not Found", "404","Not Found" ]
+ );
+
+
+my @files = ("", "/index.shtml");
+push @files, "/test.sh" if ($havecgi);
+
+my $numtests = ((scalar keys %tests) * (scalar @files) * 4);
+plan tests => $numtests, need need_apache(2), need_module('include'), need_lwp;
+
+my $loc = "/apache/acceptpathinfo";
+
+foreach my $mode (keys %tests) {
+ foreach my $file (@files) {
+
+ foreach my $pinf ("","$pathinfo") {
+
+ my ($expectedrc, $expectedbody);
+
+ if ($pinf eq "") {
+ $expectedrc = "200";
+ $expectedbody = "_\\(none\\)_";
+ }
+ else {
+ if ($file eq "") {
+ $expectedrc = "404";
+ $expectedbody = "Not Found";
+ }
+ elsif ($file eq "/index.shtml") {
+ $expectedrc = $tests{$mode}[1];
+ $expectedbody = $tests{$mode}[2];
+ }
+ else {
+ $expectedrc = $tests{$mode}[3];
+ $expectedbody = $tests{$mode}[4];
+ }
+ }
+
+
+ my $req = $loc.$tests{$mode}[0].$file.$pinf;
+
+ my $resp = GET $req;
+
+ ok t_cmp($resp->code,
+ $expectedrc,
+ "AcceptPathInfo $mode return code for $req"
+ );
+
+ my $actual = super_chomp($resp->content);
+ ok t_cmp($actual,
+ qr/$expectedbody/,
+ "AcceptPathInfo $mode body for $req"
+ );
+ }
+ }
+}
+
+sub super_chomp {
+ my ($body) = shift;
+
+ ## super chomp - all leading and trailing \n (and \r for win32)
+ $body =~ s/^[\n\r]*//;
+ $body =~ s/[\n\r]*$//;
+ ## and all the rest change to spaces
+ $body =~ s/\n/ /g;
+ $body =~ s/\r//g; #rip out all remaining \r's
+
+ $body;
+}