diff options
Diffstat (limited to 'tests/testserver/apache2/testdata/www/cgi-bin')
7 files changed, 118 insertions, 0 deletions
diff --git a/tests/testserver/apache2/testdata/www/cgi-bin/echo.cgi b/tests/testserver/apache2/testdata/www/cgi-bin/echo.cgi new file mode 100755 index 0000000000..16315a3db6 --- /dev/null +++ b/tests/testserver/apache2/testdata/www/cgi-bin/echo.cgi @@ -0,0 +1,11 @@ +#!/usr/bin/perl + +if ($ENV{'REQUEST_METHOD'} eq "GET") { + $request = $ENV{'QUERY_STRING'}; +} elsif ($ENV{'REQUEST_METHOD'} eq "POST") { + read(STDIN, $request, $ENV{'CONTENT_LENGTH'}) || die "Could not get query\n"; +} + +print "Content-type: text/plain\n\n"; +print $request; + diff --git a/tests/testserver/apache2/testdata/www/cgi-bin/get-cookie.cgi b/tests/testserver/apache2/testdata/www/cgi-bin/get-cookie.cgi new file mode 100755 index 0000000000..59f40ac78b --- /dev/null +++ b/tests/testserver/apache2/testdata/www/cgi-bin/get-cookie.cgi @@ -0,0 +1,5 @@ +#!/bin/sh + +echo "Content-Type: text/plain" +echo +echo "$HTTP_COOKIE" diff --git a/tests/testserver/apache2/testdata/www/cgi-bin/http-delete.cgi b/tests/testserver/apache2/testdata/www/cgi-bin/http-delete.cgi new file mode 100755 index 0000000000..18000c9f4c --- /dev/null +++ b/tests/testserver/apache2/testdata/www/cgi-bin/http-delete.cgi @@ -0,0 +1,22 @@ +#!/usr/bin/perl + +use CGI; + +if ($ENV{'REQUEST_METHOD'} eq "DELETE") { + $queryString = $ENV{'QUERY_STRING'}; + if ($queryString eq "200-ok") { + $returnCode = 200; + } elsif ($queryString eq "202-accepted") { + $returnCode = 202; + } elsif ($queryString eq "204-no-content") { + $returnCode = 204; + } else { + $returnCode = 404; + } +} else { + # 405 = Method Not Allowed + $returnCode = 405; +} + +$q = new CGI; +print $q->header(-status=>$returnCode); diff --git a/tests/testserver/apache2/testdata/www/cgi-bin/http-unknown-authentication-method.cgi b/tests/testserver/apache2/testdata/www/cgi-bin/http-unknown-authentication-method.cgi new file mode 100755 index 0000000000..ce47e8384c --- /dev/null +++ b/tests/testserver/apache2/testdata/www/cgi-bin/http-unknown-authentication-method.cgi @@ -0,0 +1,17 @@ +#!/usr/bin/perl + +use CGI; + +$queryString = $ENV{'QUERY_STRING'}; +my $message; +if ($queryString eq "407-proxy-authorization-required") { + $status = 407; +} else { + $status = 401; +} + +$q = new CGI; +print $q->header(-status=>$status, + -type=>"text/plain", + -WWW_Authenticate=>'WSSE realm="Test", profile="TestProfile"'), + "authorization required"; diff --git a/tests/testserver/apache2/testdata/www/cgi-bin/httpcachetest_expires500.cgi b/tests/testserver/apache2/testdata/www/cgi-bin/httpcachetest_expires500.cgi new file mode 100755 index 0000000000..66a3741641 --- /dev/null +++ b/tests/testserver/apache2/testdata/www/cgi-bin/httpcachetest_expires500.cgi @@ -0,0 +1,12 @@ +#!/bin/bash +if [ "${HTTP_IF_MODIFIED_SINCE}" ] +then + echo "Status: 500" + echo "" + exit; +fi + +echo "Expires: Mon, 30 Oct 2028 14:19:41 GMT" +echo "Content-type: text/html"; +echo "" +echo "Hello World!" diff --git a/tests/testserver/apache2/testdata/www/cgi-bin/multipart.cgi b/tests/testserver/apache2/testdata/www/cgi-bin/multipart.cgi new file mode 100755 index 0000000000..6973875cc9 --- /dev/null +++ b/tests/testserver/apache2/testdata/www/cgi-bin/multipart.cgi @@ -0,0 +1,42 @@ +#!/usr/bin/perl + +use CGI; +use Digest::MD5 qw(md5_hex); + +$q = new CGI; +print $q->header(); + +$contentType = $ENV{"CONTENT_TYPE"}; +print "content type: $contentType\n"; + +if ($contentType =~ /^multipart\/form-data/) { + foreach my $key ($q->param) { + foreach my $value ($q->param($key)) { + if ($key =~ /text/) { + $retValue = $value; + } else { + $retValue = md5_hex($value); + } + print "key: $key, value: $retValue\n"; + } + } +} else { + #$contentLength = $ENV{"CONTENT_LENGTH"}; + #print "content length: $contentLength\r\n"; + + $data = $q->param('POSTDATA'); + $data =~ s/--\S*--$//; # remove ending boundary + @parts = split(/--\S*\r\n/, $data); + shift(@parts); + foreach (@parts) { + #print "raw: $_"; + ($header, $content) = split("\r\n\r\n"); + @headerFields = split("\r\n", $header); + foreach (@headerFields) { + ($fieldName, $value) = split(": "); + print "header: $fieldName, value: '$value'\n"; + } + $content =~ s/\r\n//; + print "content: $content\n\n"; + } +} diff --git a/tests/testserver/apache2/testdata/www/cgi-bin/set-cookie.cgi b/tests/testserver/apache2/testdata/www/cgi-bin/set-cookie.cgi new file mode 100755 index 0000000000..dc463f00f3 --- /dev/null +++ b/tests/testserver/apache2/testdata/www/cgi-bin/set-cookie.cgi @@ -0,0 +1,9 @@ +#!/bin/sh + +echo "Content-type: text/plain" +while read line; do + echo "Set-Cookie: $line" +done + +echo +echo "Success" |