summaryrefslogtreecommitdiffstats
path: root/debian/perl-framework/t/htdocs/modules/cgi
diff options
context:
space:
mode:
Diffstat (limited to 'debian/perl-framework/t/htdocs/modules/cgi')
-rwxr-xr-xdebian/perl-framework/t/htdocs/modules/cgi/acceptpathinfodefault.sh4
-rwxr-xr-xdebian/perl-framework/t/htdocs/modules/cgi/acceptpathinfooff.sh4
-rwxr-xr-xdebian/perl-framework/t/htdocs/modules/cgi/acceptpathinfoon.sh4
-rw-r--r--debian/perl-framework/t/htdocs/modules/cgi/action.pl.PL10
-rw-r--r--debian/perl-framework/t/htdocs/modules/cgi/big.pl.PL22
-rwxr-xr-xdebian/perl-framework/t/htdocs/modules/cgi/bogus-perl.pl.PL2
-rwxr-xr-xdebian/perl-framework/t/htdocs/modules/cgi/bogus-sh.sh2
-rwxr-xr-xdebian/perl-framework/t/htdocs/modules/cgi/bogus1k.pl.PL2
-rwxr-xr-xdebian/perl-framework/t/htdocs/modules/cgi/empty.pl.PL6
-rw-r--r--debian/perl-framework/t/htdocs/modules/cgi/env.pl.PL7
-rw-r--r--debian/perl-framework/t/htdocs/modules/cgi/not-modified.pl.PL4
-rw-r--r--debian/perl-framework/t/htdocs/modules/cgi/nph-102.pl.PL9
-rw-r--r--debian/perl-framework/t/htdocs/modules/cgi/nph-dripfeed.pl.PL17
-rw-r--r--debian/perl-framework/t/htdocs/modules/cgi/nph-foldhdr.pl.PL12
-rw-r--r--debian/perl-framework/t/htdocs/modules/cgi/nph-interim1.pl.PL16
-rw-r--r--debian/perl-framework/t/htdocs/modules/cgi/nph-interim2.pl.PL16
-rw-r--r--debian/perl-framework/t/htdocs/modules/cgi/nph-stderr.pl.PL12
-rw-r--r--debian/perl-framework/t/htdocs/modules/cgi/nph-test.pl.PL9
-rw-r--r--debian/perl-framework/t/htdocs/modules/cgi/ocsp.pl.PL78
-rwxr-xr-xdebian/perl-framework/t/htdocs/modules/cgi/perl.pl.PL3
-rw-r--r--debian/perl-framework/t/htdocs/modules/cgi/perl_echo.pl.PL14
-rwxr-xr-xdebian/perl-framework/t/htdocs/modules/cgi/perl_post.pl.PL23
-rw-r--r--debian/perl-framework/t/htdocs/modules/cgi/pr37166.pl.PL8
-rw-r--r--debian/perl-framework/t/htdocs/modules/cgi/ranged.pl.PL11
-rw-r--r--debian/perl-framework/t/htdocs/modules/cgi/redirect.pl.PL5
-rwxr-xr-xdebian/perl-framework/t/htdocs/modules/cgi/sh.sh4
-rw-r--r--debian/perl-framework/t/htdocs/modules/cgi/stderr1.pl.PL7
-rw-r--r--debian/perl-framework/t/htdocs/modules/cgi/stderr2.pl.PL9
-rw-r--r--debian/perl-framework/t/htdocs/modules/cgi/stderr3.pl.PL8
-rw-r--r--debian/perl-framework/t/htdocs/modules/cgi/unique-id.pl.PL3
-rw-r--r--debian/perl-framework/t/htdocs/modules/cgi/xother.pl.PL6
31 files changed, 337 insertions, 0 deletions
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/acceptpathinfodefault.sh b/debian/perl-framework/t/htdocs/modules/cgi/acceptpathinfodefault.sh
new file mode 100755
index 0000000..d5885ee
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/acceptpathinfodefault.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+echo Content-type: text/plain
+echo
+echo $PATH_INFO
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/acceptpathinfooff.sh b/debian/perl-framework/t/htdocs/modules/cgi/acceptpathinfooff.sh
new file mode 100755
index 0000000..d5885ee
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/acceptpathinfooff.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+echo Content-type: text/plain
+echo
+echo $PATH_INFO
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/acceptpathinfoon.sh b/debian/perl-framework/t/htdocs/modules/cgi/acceptpathinfoon.sh
new file mode 100755
index 0000000..d5885ee
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/acceptpathinfoon.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+echo Content-type: text/plain
+echo
+echo $PATH_INFO
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/action.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/action.pl.PL
new file mode 100644
index 0000000..19d6529
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/action.pl.PL
@@ -0,0 +1,10 @@
+use strict;
+
+print "Content-type: text/plain\n\n";
+
+print $ENV{PATH_INFO} . "\n";
+
+if (my $ct = $ENV{CONTENT_LENGTH}) {
+ read STDIN, my $buffer, $ct;
+ print $buffer;
+}
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/big.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/big.pl.PL
new file mode 100644
index 0000000..636fb66
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/big.pl.PL
@@ -0,0 +1,22 @@
+# This is a regression test for PR 31247.
+
+# By sleeping, it ensures that the CGI bucket is left in the brigade
+# (the first 8K will be morphed into a HEAP bucket), and hence *must*
+# be setaside correctly when the byterange filter calls
+# ap_save_brigade().
+
+# Without the fix for PR 31247, the STDOUT content does not get
+# consumed as expected, so the server will deadlock as it tries to
+# consume STDERR after script execution in mod_cgi, whilst the script
+# tries to write to STDOUT. So close STDERR to avoid that.
+
+close STDERR;
+
+print "Content-type: text/plain\n\n";
+
+print "x"x8192;
+
+sleep 1;
+
+print "x"x8192;
+
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/bogus-perl.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/bogus-perl.pl.PL
new file mode 100755
index 0000000..8abb7b2
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/bogus-perl.pl.PL
@@ -0,0 +1,2 @@
+
+print "perl cgi";
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/bogus-sh.sh b/debian/perl-framework/t/htdocs/modules/cgi/bogus-sh.sh
new file mode 100755
index 0000000..3d49f92
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/bogus-sh.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+echo sh cgi
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/bogus1k.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/bogus1k.pl.PL
new file mode 100755
index 0000000..7c3d244
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/bogus1k.pl.PL
@@ -0,0 +1,2 @@
+
+print "N"x1024;
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/empty.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/empty.pl.PL
new file mode 100755
index 0000000..31e1ae9
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/empty.pl.PL
@@ -0,0 +1,6 @@
+use strict;
+
+print "Content-type: text/plain\r\n";
+print "Content-Length: 0\r\n";
+print "\r\n";
+
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/env.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/env.pl.PL
new file mode 100644
index 0000000..f776cab
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/env.pl.PL
@@ -0,0 +1,7 @@
+use strict;
+
+print "Content-type: text/plain\n\n";
+
+for (sort keys %ENV) {
+ print "$_ = $ENV{$_}\n";
+}
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/not-modified.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/not-modified.pl.PL
new file mode 100644
index 0000000..6684e48
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/not-modified.pl.PL
@@ -0,0 +1,4 @@
+use strict;
+
+print "Status: 304 Not Modified\r\n\r\n";
+
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/nph-102.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/nph-102.pl.PL
new file mode 100644
index 0000000..a49eeaa
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/nph-102.pl.PL
@@ -0,0 +1,9 @@
+
+print "HTTP/1.1 102 Please Wait...\r\n";
+print "Host: nph-102\r\n\r\n";
+
+print "HTTP/1.1 200 OK\r\n";
+print "Content-Type: text/plain\r\n\r\n";
+
+print "this is nph-stdout";
+
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/nph-dripfeed.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/nph-dripfeed.pl.PL
new file mode 100644
index 0000000..fa73355
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/nph-dripfeed.pl.PL
@@ -0,0 +1,17 @@
+print "HTTP/1.0 200 OK\r\n";
+print "Transfer-Encoding: chunked\r\n";
+print "\r\n";
+
+$| = 1;
+
+sub dripfeed {
+ my $s = shift;
+
+ while (length($s)) {
+ select(undef, undef, undef, 0.2);
+ print substr($s, 0, 1);
+ $s = substr($s, 1);
+ }
+}
+
+dripfeed "0005\r\nabcde\r\n1; foo=bar\r\nf\r\n0\r\n\r\n";
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/nph-foldhdr.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/nph-foldhdr.pl.PL
new file mode 100644
index 0000000..67d7e9f
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/nph-foldhdr.pl.PL
@@ -0,0 +1,12 @@
+# produces output with folded response headers
+
+print "HTTP/1.0 200 OK\r\n";
+
+for (1..50) {
+ print "X-Foo-Bar-$_:\n " . 'x'x($_*10) . "\n";
+ print "X-Bar-$_:\n gamm\r\n beta\n theta\r\n";
+}
+
+print "Content-type: \n text/plain\n\n";
+
+print "hello, world";
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/nph-interim1.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/nph-interim1.pl.PL
new file mode 100644
index 0000000..87c0931
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/nph-interim1.pl.PL
@@ -0,0 +1,16 @@
+foreach $i (1..5) {
+print <<EOT1
+HTTP/1.1 100 Continue
+Server: Sausages/1.0
+
+EOT1
+;
+}
+
+print <<EOT2
+HTTP/1.1 200 OK
+Content-Type: text/html
+
+Hello world
+EOT2
+;
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/nph-interim2.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/nph-interim2.pl.PL
new file mode 100644
index 0000000..8a90b2f
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/nph-interim2.pl.PL
@@ -0,0 +1,16 @@
+foreach $i (1..50) {
+print <<EOT1
+HTTP/1.1 100 Continue
+Server: Sausages/1.0
+
+EOT1
+;
+}
+
+print <<EOT2
+HTTP/1.1 200 OK
+Content-Type: text/html
+
+Hello world
+EOT2
+;
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/nph-stderr.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/nph-stderr.pl.PL
new file mode 100644
index 0000000..601adf9
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/nph-stderr.pl.PL
@@ -0,0 +1,12 @@
+# produces lots of stderr output
+
+print "HTTP/1.0 200 OK\r\n";
+
+print STDERR 'x'x8192;
+print "Content-Type: text/plain\r\n\r\n";
+
+print "this is nph-stdout";
+
+close STDOUT;
+
+print STDERR "this is nph-stderr";
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/nph-test.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/nph-test.pl.PL
new file mode 100644
index 0000000..e679931
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/nph-test.pl.PL
@@ -0,0 +1,9 @@
+print "HTTP/1.0 200 OK\r\n";
+print join("\n",
+ 'Content-type: text/html',
+ 'Pragma: no-cache',
+ 'Cache-control: must-revalidate, no-cache, no-store',
+ 'Expires: -1',
+ "\n");
+
+print "ok\n";
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/ocsp.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/ocsp.pl.PL
new file mode 100644
index 0000000..efdbe8b
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/ocsp.pl.PL
@@ -0,0 +1,78 @@
+use File::Temp qw/:POSIX/;
+
+my $caroot = $ENV{SSL_CA_ROOT};
+
+if (! -d $caroot) {
+ print <<EOT
+Status: 500 Internal Server Error
+Content-Type: text/plain
+
+Cannot find CA root at "$ENV{SSL_CA_ROOT}"
+EOT
+ ;
+ print STDERR "SSL_CA_ROOT env var not set or can't find CA root.\n";
+ exit(1);
+}
+
+chdir($caroot);
+
+my $filein = tmpnam();
+my $fileout = tmpnam();
+
+# Enable slurp mode (read all lines at once)
+local $/;
+
+# Copy STDIN to $filein, which will be used as input for openssl
+open(IN, '>', "$filein") or die "Could not open file '$filein' for write: $!";
+binmode IN;
+print IN <STDIN>;
+close(IN);
+
+my $cmd = 'openssl ocsp -CA certs/ca.crt'.
+ ' -index index.txt'.
+ ' -rsigner certs/server.crt'.
+ ' -rkey keys/server.pem'.
+ ' -reqin ' . $filein .
+ ' -respout ' . $fileout;
+system($cmd);
+
+# Check system result
+my $err = '';
+if ($? == -1) {
+ my $err = "failed to execute '$cmd': $!\n";
+}
+elsif ($? & 127) {
+ my $err = sprintf("child '$cmd' died with signal %d, %s coredump\n",
+ ($? & 127), ($? & 128) ? 'with' : 'without');
+}
+else {
+ my $rc = $? >> 8;
+ my $err = "child '$cmd' exited with value $rc\n" if $rc;
+}
+
+unlink($filein);
+
+if ($err ne '') {
+ print <<EOT
+Status: 500 Internal Server Error
+Content-Type: text/plain
+
+$err
+EOT
+ ;
+ print STDERR $err;
+ exit(1);
+}
+
+print <<EOT
+Content-Type: application/ocsp-response
+
+EOT
+;
+
+# Copy openssl result from $fileout to STDOUT
+open(OUT, '<', "$fileout") or die "Could not open file '$fileout' for read: $!";
+binmode OUT;
+print <OUT>;
+close(OUT);
+unlink($fileout);
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/perl.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/perl.pl.PL
new file mode 100755
index 0000000..51969cc
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/perl.pl.PL
@@ -0,0 +1,3 @@
+
+print "Content-type: text/plain\n\n";
+print "perl cgi";
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/perl_echo.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/perl_echo.pl.PL
new file mode 100644
index 0000000..b7591a6
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/perl_echo.pl.PL
@@ -0,0 +1,14 @@
+#echo some data back to the client
+
+print "Content-type: text/plain\n\n";
+
+if (my $ct = $ENV{CONTENT_LENGTH}) {
+ read STDIN, my $buffer, $ct;
+ print $buffer;
+}
+elsif (my $qs = $ENV{QUERY_STRING}) {
+ print $qs;
+}
+else {
+ print "nada";
+}
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/perl_post.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/perl_post.pl.PL
new file mode 100755
index 0000000..e19d204
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/perl_post.pl.PL
@@ -0,0 +1,23 @@
+local ($buffer, @pairs, $pair, $name, $value);
+
+print "Content-type: text/plain\n\n";
+
+$ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/;
+print "$ENV{'REQUEST_METHOD'}\n";
+
+# Read in text
+if ($ENV{'REQUEST_METHOD'} eq "POST") {
+ read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
+} else {
+ $buffer = $ENV{'QUERY_STRING'};
+}
+
+# Split information into name/value pairs
+@pairs = split(/&/, $buffer);
+foreach $pair (@pairs) {
+ ($name, $value) = split(/=/, $pair);
+ $value =~ tr/+/ /;
+ $value =~ s/%(..)/pack("C", hex($1))/eg;
+
+ print "$name: $value\n";
+}
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/pr37166.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/pr37166.pl.PL
new file mode 100644
index 0000000..f565c5c
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/pr37166.pl.PL
@@ -0,0 +1,8 @@
+print <<EOT
+Status: 200
+Last-Modified: Tue, 15 Feb 2005 15:00:00 GMT
+Content-Type: text/html
+
+Hello world
+EOT
+;
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/ranged.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/ranged.pl.PL
new file mode 100644
index 0000000..9d81f5d
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/ranged.pl.PL
@@ -0,0 +1,11 @@
+use strict;
+
+print "Content-type: text/plain\n";
+
+if ($ENV{'HTTP_RANGE'} eq 'bytes=5-10/10') {
+ print "Content-Range: bytes 5-10/10\n\n";
+ print "hello\n";
+} else {
+ print "\npardon?\n";
+}
+
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/redirect.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/redirect.pl.PL
new file mode 100644
index 0000000..9dc93e8
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/redirect.pl.PL
@@ -0,0 +1,5 @@
+print <<EOT
+Location: /foobar.html
+
+EOT
+;
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/sh.sh b/debian/perl-framework/t/htdocs/modules/cgi/sh.sh
new file mode 100755
index 0000000..2907b61
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/sh.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+echo Content-type: text/plain
+echo
+echo sh cgi
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/stderr1.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/stderr1.pl.PL
new file mode 100644
index 0000000..71b5a11
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/stderr1.pl.PL
@@ -0,0 +1,7 @@
+# produces lots of stderr output
+
+print STDERR 'x'x8192;
+
+print "Content-Type: text/plain\n\n";
+
+print "this is stdout";
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/stderr2.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/stderr2.pl.PL
new file mode 100644
index 0000000..a1580af
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/stderr2.pl.PL
@@ -0,0 +1,9 @@
+# closes stderr during script execution
+
+close STDERR;
+
+print "Content-Type: text/plain\n\n";
+
+sleep 1;
+
+print "this is also stdout";
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/stderr3.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/stderr3.pl.PL
new file mode 100644
index 0000000..f4927b5
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/stderr3.pl.PL
@@ -0,0 +1,8 @@
+# closes stderr during script execution
+
+print "Content-Type: text/plain\n\n";
+print "this is more stdout";
+
+close STDOUT;
+
+print STDERR "this is a post-stdout-closure error message";
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/unique-id.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/unique-id.pl.PL
new file mode 100644
index 0000000..e54ba40
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/unique-id.pl.PL
@@ -0,0 +1,3 @@
+print "Content-type: text/plain\n\n";
+
+print $ENV{UNIQUE_ID};
diff --git a/debian/perl-framework/t/htdocs/modules/cgi/xother.pl.PL b/debian/perl-framework/t/htdocs/modules/cgi/xother.pl.PL
new file mode 100644
index 0000000..7cd005e
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/cgi/xother.pl.PL
@@ -0,0 +1,6 @@
+use strict;
+
+print "X-Foo: bar\n";
+print "Content-type: text/plain\n\n";
+
+print "helloworld";