jwoolley 02/05/09 02:57:32
Modified: perl-framework/t/conf extra.conf.in
Added: perl-framework/t/apache acceptpathinfo.t
perl-framework/t/htdocs/apache/acceptpathinfo index.shtml
test.sh
perl-framework/t/htdocs/apache/acceptpathinfo/off
index.shtml test.sh
perl-framework/t/htdocs/apache/acceptpathinfo/on index.shtml
test.sh
Log:
Add tests for AcceptPathInfo, which is currently broken (still :-/ ) in
the DirectoryIndex case as of 2.0.37-dev.
Revision Changes Path
1.1 httpd-test/perl-framework/t/apache/acceptpathinfo.t
Index: acceptpathinfo.t
===================================================================
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, sub { have_apache(2) && have_module('include') };
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 ne "/test.sh") {
$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 $actual = GET_RC "$req";
ok t_cmp($expectedrc,
$actual,
"AcceptPathInfo $mode return code for $req"
);
$actual = super_chomp(GET_BODY "$req");
ok t_cmp(qr/$expectedbody/,
$actual,
"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;
}
1.38 +25 -0 httpd-test/perl-framework/t/conf/extra.conf.in
Index: extra.conf.in
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/t/conf/extra.conf.in,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -u -r1.37 -r1.38
--- extra.conf.in 9 May 2002 07:14:36 -0000 1.37
+++ extra.conf.in 9 May 2002 09:57:31 -0000 1.38
@@ -8,6 +8,31 @@
</Directory>
##
+## AcceptPathInfo test config
+##
+<IfDefine APACHE2>
+ <Directory @SERVERROOT@/htdocs/apache/acceptpathinfo>
+ # default is AcceptPathInfo default
+ Order Deny,Allow
+ Allow from all
+ <IfModule @CGI_MODULE@>
+ AddHandler cgi-script .sh
+ Options +ExecCGI +Includes +Indexes
+ </IfModule>
+ <IfModule mod_include.c>
+ DirectoryIndex index.shtml
+ AddOutputFilter INCLUDES shtml
+ </IfModule>
+ </Directory>
+ <Directory @SERVERROOT@/htdocs/apache/acceptpathinfo/on>
+ AcceptPathInfo on
+ </Directory>
+ <Directory @SERVERROOT@/htdocs/apache/acceptpathinfo/off>
+ AcceptPathInfo off
+ </Directory>
+</IfDefine>
+
+##
## mod_php4 test config
##
1.1
httpd-test/perl-framework/t/htdocs/apache/acceptpathinfo/index.shtml
Index: index.shtml
===================================================================
_<!--#echo var="PATH_INFO"-->_
1.1
httpd-test/perl-framework/t/htdocs/apache/acceptpathinfo/test.sh
Index: test.sh
===================================================================
#!/bin/sh
echo Content-type: text/plain
echo
if [ -z "$PATH_INFO" ]; then
echo "_(none)_"
else
echo _${PATH_INFO}_
fi
1.1
httpd-test/perl-framework/t/htdocs/apache/acceptpathinfo/off/index.shtml
Index: index.shtml
===================================================================
_<!--#echo var="PATH_INFO"-->_
1.1
httpd-test/perl-framework/t/htdocs/apache/acceptpathinfo/off/test.sh
Index: test.sh
===================================================================
#!/bin/sh
echo Content-type: text/plain
echo
if [ -z "$PATH_INFO" ]; then
echo "_(none)_"
else
echo _${PATH_INFO}_
fi
1.1
httpd-test/perl-framework/t/htdocs/apache/acceptpathinfo/on/index.shtml
Index: index.shtml
===================================================================
_<!--#echo var="PATH_INFO"-->_
1.1
httpd-test/perl-framework/t/htdocs/apache/acceptpathinfo/on/test.sh
Index: test.sh
===================================================================
#!/bin/sh
echo Content-type: text/plain
echo
if [ -z "$PATH_INFO" ]; then
echo "_(none)_"
else
echo _${PATH_INFO}_
fi