summaryrefslogtreecommitdiffstats
path: root/debian/perl-framework/t/modules/include.t
diff options
context:
space:
mode:
Diffstat (limited to 'debian/perl-framework/t/modules/include.t')
-rw-r--r--debian/perl-framework/t/modules/include.t49
1 files changed, 44 insertions, 5 deletions
diff --git a/debian/perl-framework/t/modules/include.t b/debian/perl-framework/t/modules/include.t
index 64b2fdc..9ff2411 100644
--- a/debian/perl-framework/t/modules/include.t
+++ b/debian/perl-framework/t/modules/include.t
@@ -28,6 +28,7 @@ my $htdocs = Apache::Test::vars('documentroot');
my %test = (
"echo.shtml" => "echo.shtml",
"set.shtml" => "set works",
+"comment.shtml" => "No comment here",
"include1.shtml" => "inc-two.shtml body include.shtml body",
"include2.shtml" => "inc-two.shtml body include.shtml body",
"include3.shtml" => "inc-two.shtml body inc-one.shtml body ".
@@ -96,6 +97,10 @@ my %test = (
"virtualq.shtml?foo=bar" => "foo=bar pass inc-two.shtml body foo=bar", # PR#12655
"inc-nego.shtml" => "index.html.en", # requires mod_negotiation
+"mod_request/echo.shtml"=> "echo.shtml",
+"mod_request/post.shtml?foo=bar&foo2=bar2"
+ => "GET foo: bar foo2: bar2",
+"mod_request/post.shtml"=> "POST foo: bar foo2: bar2", # will be twice, only the first one succeed
);
my %ap_expr_test = (
@@ -227,15 +232,16 @@ unless ($have_apache_2) {
push @todo, (scalar keys %tests) + 1;
}
-# in addition to %tests, there are 1 fsize and 1 flastmod test,
+# in addition to %tests, there are 1 mod_request expected failure,
+# 1 fsize and 1 flastmod test,
# 1 GET test, 2 query string tests, 14 XBitHack tests and 14
# tests that use mod_bucketeer to construct brigades for mod_include
-my $tests = (scalar keys %tests) + @patterns + 1 + 1 + 1 + 2 + 14 + 14;
+my $tests = (scalar keys %tests) + 1 + @patterns + 1 + 1 + 1 + 2 + 14 + 14;
plan tests => $tests,
todo => \@todo,
- need need_lwp, need_module 'include';
+ need 'DateTime', need_lwp, need_module 'include';
foreach $doc (sort keys %tests) {
# do as much from %test as we can
@@ -267,6 +273,35 @@ foreach $doc (sort keys %tests) {
skip "Skipping 'exec cgi' test; no cgi module.", 1;
}
}
+ elsif ($doc =~ m/mod_request.*\?/) {
+ # param in the url ==> use GET
+ if (have_cgi) {
+ ok t_cmp(super_chomp(GET_BODY "$dir$doc"),
+ $tests{$doc},
+ "GET $dir$doc"
+ );
+ }
+ else {
+ skip "Skipping 'exec cgi' test; no cgi module.", 1;
+ }
+ }
+ elsif ($doc =~ m/mod_request/) {
+ # no param in the url ==> use POST with a content
+ if (have_cgi) {
+ ok t_cmp(super_chomp(POST_BODY "$dir$doc", content => "foo=bar&foo2=bar2"),
+ $tests{$doc},
+ "POST $dir$doc"
+ );
+ if ($doc =~ m/mod_request.*post/) {
+ # KeptBodySize is 32
+ my $r = POST("$dir$doc", content => "foo=bar&foo2=bar2&foo3=bar3&foo4=bar4");
+ ok t_cmp($r->code, 413, "sizeof(body) > KeptBodySize");
+ }
+ }
+ else {
+ skip "Skipping 'exec cgi' test; no cgi module.", 2;
+ }
+ }
else {
ok t_cmp(super_chomp(GET_BODY "$dir$doc"),
$tests{$doc},
@@ -311,6 +346,10 @@ unless(eval "require POSIX") {
else {
# use DateTime and avoid the system locale messing things up
use DateTime;
+ # Only for checking, whether system strftime supports %s
+ use POSIX;
+ my $strftime_gnu = (POSIX::strftime("%s", gmtime()) eq '%s' ? 0 : 1);
+
my $result = super_chomp(GET_BODY "${dir}file.shtml");
$result = single_space($result);
@@ -325,8 +364,8 @@ else {
my $expected = join ' ' =>
$dt->strftime("%A, %B %e, %G"),
$dt->strftime("%A, %B %e, %G"),
- $dt->strftime("%s"),
- $dt->strftime("%s");
+ $strftime_gnu ? $dt->strftime("%s") : '%s',
+ $strftime_gnu ? $dt->strftime("%s") : '%s';
# trim output
$expected = single_space($expected);