From 5ec5e124c1697f71d714f631a762ccbf3f168023 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Sun, 27 Dec 2020 21:29:19 -0500 Subject: [tests] consolidate some tests/ content --- tests/docroot/123/100.txt | 10 ------ tests/docroot/123/12345.html | 1 - tests/docroot/123/12345.txt | 1 - tests/docroot/123/Makefile.am | 1 - tests/docroot/123/dummyfile.bla | 1 - tests/docroot/Makefile.am | 2 +- tests/docroot/www/Makefile.am | 8 ----- tests/docroot/www/cgi-pathinfo.pl | 7 ----- tests/docroot/www/cgi.pl | 47 ++++++++++++++++++++++++----- tests/docroot/www/crlfcrash.pl | 4 --- tests/docroot/www/expire/Makefile.am | 1 - tests/docroot/www/expire/access.txt | 0 tests/docroot/www/expire/modification.txt | 0 tests/docroot/www/get-header.pl | 8 ----- tests/docroot/www/get-post-len.pl | 13 -------- tests/docroot/www/indexfile/Makefile.am | 2 +- tests/docroot/www/indexfile/query_string.pl | 3 -- tests/docroot/www/ip.pl | 13 -------- tests/docroot/www/nph-status.pl | 10 ------ tests/docroot/www/send404.pl | 6 ---- 20 files changed, 42 insertions(+), 96 deletions(-) delete mode 100644 tests/docroot/123/100.txt delete mode 100644 tests/docroot/123/12345.html delete mode 100644 tests/docroot/123/12345.txt delete mode 100644 tests/docroot/123/Makefile.am delete mode 100644 tests/docroot/123/dummyfile.bla delete mode 100755 tests/docroot/www/cgi-pathinfo.pl delete mode 100755 tests/docroot/www/crlfcrash.pl delete mode 100644 tests/docroot/www/expire/Makefile.am delete mode 100644 tests/docroot/www/expire/access.txt delete mode 100644 tests/docroot/www/expire/modification.txt delete mode 100755 tests/docroot/www/get-header.pl delete mode 100755 tests/docroot/www/get-post-len.pl delete mode 100755 tests/docroot/www/indexfile/query_string.pl delete mode 100755 tests/docroot/www/ip.pl delete mode 100755 tests/docroot/www/nph-status.pl delete mode 100755 tests/docroot/www/send404.pl (limited to 'tests/docroot') diff --git a/tests/docroot/123/100.txt b/tests/docroot/123/100.txt deleted file mode 100644 index c4782fd3..00000000 --- a/tests/docroot/123/100.txt +++ /dev/null @@ -1,10 +0,0 @@ -123456789 -123456789 -123456789 -123456789 -123456789 -123456789 -123456789 -123456789 -123456789 -abcdefghi diff --git a/tests/docroot/123/12345.html b/tests/docroot/123/12345.html deleted file mode 100644 index e56e15bb..00000000 --- a/tests/docroot/123/12345.html +++ /dev/null @@ -1 +0,0 @@ -12345 diff --git a/tests/docroot/123/12345.txt b/tests/docroot/123/12345.txt deleted file mode 100644 index e56e15bb..00000000 --- a/tests/docroot/123/12345.txt +++ /dev/null @@ -1 +0,0 @@ -12345 diff --git a/tests/docroot/123/Makefile.am b/tests/docroot/123/Makefile.am deleted file mode 100644 index 4652a4f9..00000000 --- a/tests/docroot/123/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -EXTRA_DIST=100.txt 12345.html 12345.txt dummyfile.bla diff --git a/tests/docroot/123/dummyfile.bla b/tests/docroot/123/dummyfile.bla deleted file mode 100644 index e56e15bb..00000000 --- a/tests/docroot/123/dummyfile.bla +++ /dev/null @@ -1 +0,0 @@ -12345 diff --git a/tests/docroot/Makefile.am b/tests/docroot/Makefile.am index 5feab8ce..d86055d8 100644 --- a/tests/docroot/Makefile.am +++ b/tests/docroot/Makefile.am @@ -1,2 +1,2 @@ -SUBDIRS=123 www +SUBDIRS=www GNUMAKEFLAGS=--no-print-directory -s diff --git a/tests/docroot/www/Makefile.am b/tests/docroot/www/Makefile.am index 72bbeb51..4d702f73 100644 --- a/tests/docroot/www/Makefile.am +++ b/tests/docroot/www/Makefile.am @@ -1,21 +1,13 @@ EXTRA_DIST=\ 404.html \ 404.pl \ - cgi-pathinfo.pl \ cgi.pl \ - crlfcrash.pl \ exec-date.shtml \ - get-header.pl \ - get-post-len.pl \ index.html \ index.txt \ - ip.pl \ - nph-status.pl \ prefix.fcgi \ - send404.pl \ ssi-include.shtml \ ssi-include.txt \ ssi.shtml SUBDIRS=\ - expire \ indexfile diff --git a/tests/docroot/www/cgi-pathinfo.pl b/tests/docroot/www/cgi-pathinfo.pl deleted file mode 100755 index 6b3a3355..00000000 --- a/tests/docroot/www/cgi-pathinfo.pl +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env perl - -print "Content-Type: text/html\r\n\r\n"; - -print $ENV{"PATH_INFO"}; - -0; diff --git a/tests/docroot/www/cgi.pl b/tests/docroot/www/cgi.pl index c149cee1..3e7ea872 100755 --- a/tests/docroot/www/cgi.pl +++ b/tests/docroot/www/cgi.pl @@ -1,15 +1,29 @@ #!/usr/bin/env perl +# env +if ($ENV{"QUERY_STRING"} =~ /^env=(\w+)/) { + print "Status: 200\r\n\r\n$ENV{$1}"; + exit 0; +} + +# redirection if ($ENV{"QUERY_STRING"} eq "internal-redir") { - print "Location: /cgi-pathinfo.pl/foo\r\n\r\n"; + print "Location: /indexfile/index.pl/foo\r\n\r\n"; exit 0; } +# redirection if ($ENV{"QUERY_STRING"} eq "external-redir") { print "Location: http://www.example.org:2048/\r\n\r\n"; exit 0; } +# 404 +if ($ENV{"QUERY_STRING"} eq "send404") { + print "Status: 404\n\nsend404\n"; + exit 0; +} + # X-Sendfile if ($ENV{"QUERY_STRING"} eq "xsendfile") { # urlencode path for CGI header @@ -25,15 +39,34 @@ if ($ENV{"QUERY_STRING"} eq "xsendfile") { exit 0; } -# env -if ($ENV{"QUERY_STRING"} =~ /^env=(\w+)/) { - print "Status: 200\r\n\r\n$ENV{$1}"; +# NPH +if ($ENV{"QUERY_STRING"} =~ /^nph=(\w+)/) { + print "Status: $1 FooBar\r\n\r\n"; exit 0; } -# default -print "Content-Type: text/html\r\n\r\n"; +# crlfcrash +if ($ENV{"QUERY_STRING"} eq "crlfcrash") { + print "Location: http://www.example.org/\r\n\n\n"; + exit 0; +} -print $ENV{"SCRIPT_NAME"}; +# POST length +if ($ENV{"QUERY_STRING"} eq "post-len") { + $cl = $ENV{CONTENT_LENGTH} || 0; + my $len = 0; + if ($ENV{"REQUEST_METHOD"} eq "POST") { + while (<>) { # expect test data to end in newline + $len += length($_); + last if $len >= $cl; + } + } + print "Status: 200\r\n\r\n$len"; + exit 0; +} + +# default +print "Content-Type: text/plain\r\n\r\n"; +print $ENV{"QUERY_STRING"}; 0; diff --git a/tests/docroot/www/crlfcrash.pl b/tests/docroot/www/crlfcrash.pl deleted file mode 100755 index f90bc86c..00000000 --- a/tests/docroot/www/crlfcrash.pl +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env perl -# -print "Location: http://www.example.org/\r\n\n\n"; -exit; diff --git a/tests/docroot/www/expire/Makefile.am b/tests/docroot/www/expire/Makefile.am deleted file mode 100644 index 7812b143..00000000 --- a/tests/docroot/www/expire/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -EXTRA_DIST=access.txt modification.txt diff --git a/tests/docroot/www/expire/access.txt b/tests/docroot/www/expire/access.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/docroot/www/expire/modification.txt b/tests/docroot/www/expire/modification.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/docroot/www/get-header.pl b/tests/docroot/www/get-header.pl deleted file mode 100755 index 1e19677d..00000000 --- a/tests/docroot/www/get-header.pl +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env perl - -my $s = $ENV{$ENV{"QUERY_STRING"}}; - -printf("Content-Length: %d\r\n", length($s)); -print "Content-Type: text/plain\r\n\r\n"; - -print $s; diff --git a/tests/docroot/www/get-post-len.pl b/tests/docroot/www/get-post-len.pl deleted file mode 100755 index 82276bd6..00000000 --- a/tests/docroot/www/get-post-len.pl +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env perl - -print "Content-Type: text/plain\r\n\r\n"; - -if ($ENV{"REQUEST_METHOD"} eq "POST") { - my $l = 0; - while(<>) { - $l += length($_); - } - print $l; -} else { - print "0"; -} diff --git a/tests/docroot/www/indexfile/Makefile.am b/tests/docroot/www/indexfile/Makefile.am index 140163d3..b96fec3d 100644 --- a/tests/docroot/www/indexfile/Makefile.am +++ b/tests/docroot/www/indexfile/Makefile.am @@ -1 +1 @@ -EXTRA_DIST=index.pl query_string.pl +EXTRA_DIST=index.pl diff --git a/tests/docroot/www/indexfile/query_string.pl b/tests/docroot/www/indexfile/query_string.pl deleted file mode 100755 index b775f6f6..00000000 --- a/tests/docroot/www/indexfile/query_string.pl +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env perl - -print "Status: 200\n\n$ENV{QUERY_STRING}" diff --git a/tests/docroot/www/ip.pl b/tests/docroot/www/ip.pl deleted file mode 100755 index fa56ddcf..00000000 --- a/tests/docroot/www/ip.pl +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env perl -print "Content-Type: text/html\r\n\r\n"; -print $ENV{'REMOTE_ADDR'}; - -if ($ENV{'QUERY_STRING'} eq 'info') { - print "\nF:",$ENV{'HTTP_X_FORWARDED_FOR'},"\n"; - - while (my($key, $value) = each %ENV) { - printf "%s => %s\n", $key, $value; - } -} - -0; diff --git a/tests/docroot/www/nph-status.pl b/tests/docroot/www/nph-status.pl deleted file mode 100755 index b42da741..00000000 --- a/tests/docroot/www/nph-status.pl +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env perl - -my $status = 200; - -if (defined $ENV{"QUERY_STRING"}) { - $status = $ENV{"QUERY_STRING"}; -} - -print "HTTP/1.0 ".$status." FooBar\r\n"; -print "\r\n"; diff --git a/tests/docroot/www/send404.pl b/tests/docroot/www/send404.pl deleted file mode 100755 index 45c619a7..00000000 --- a/tests/docroot/www/send404.pl +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env perl - -print "Status: 404\n", - "Content-Type: text/plain\n", - "\n", - "send404\n"; -- cgit v1.2.1