diff options
author | Jan Kneschke <jan@kneschke.de> | 2005-08-31 12:55:44 +0000 |
---|---|---|
committer | Jan Kneschke <jan@kneschke.de> | 2005-08-31 12:55:44 +0000 |
commit | 79886610900e95efcbea3ee73f9f612c7788bbca (patch) | |
tree | b5a2778c47daf99d630675bf8b4d3f8ea40f019e /tests | |
parent | 5c20c426b7e532602613e8796a6f8b55fa31b5ad (diff) | |
download | lighttpd-git-79886610900e95efcbea3ee73f9f612c7788bbca.tar.gz |
added tests for keep-alive and setenv and passed a ARRAY ref instead of a HASH ref
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@654 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/LightyTest.pm | 10 | ||||
-rw-r--r-- | tests/Makefile.am | 4 | ||||
-rwxr-xr-x | tests/core-condition.t | 14 | ||||
-rwxr-xr-x | tests/core-keepalive.t | 76 | ||||
-rwxr-xr-x | tests/core-request.t | 58 | ||||
-rwxr-xr-x | tests/core-response.t | 20 | ||||
-rwxr-xr-x | tests/core-var-include.t | 4 | ||||
-rwxr-xr-x | tests/core.t | 30 | ||||
-rw-r--r-- | tests/docroot/www/Makefile.am | 2 | ||||
-rw-r--r-- | tests/docroot/www/get-post-len.pl | 15 | ||||
-rw-r--r-- | tests/lighttpd.conf | 2 | ||||
-rwxr-xr-x | tests/mod-access.t | 2 | ||||
-rwxr-xr-x | tests/mod-auth.t | 8 | ||||
-rwxr-xr-x | tests/mod-cgi.t | 44 | ||||
-rwxr-xr-x | tests/mod-compress.t | 10 | ||||
-rwxr-xr-x | tests/mod-fastcgi.t | 60 | ||||
-rwxr-xr-x | tests/mod-proxy.t | 4 | ||||
-rwxr-xr-x | tests/mod-redirect.t | 8 | ||||
-rwxr-xr-x | tests/mod-rewrite.t | 6 | ||||
-rwxr-xr-x | tests/mod-secdownload.t | 10 | ||||
-rwxr-xr-x | tests/mod-setenv.t | 53 | ||||
-rwxr-xr-x | tests/mod-ssi.t | 2 | ||||
-rwxr-xr-x | tests/mod-userdir.t | 6 | ||||
-rwxr-xr-x | tests/request.t | 58 |
24 files changed, 340 insertions, 166 deletions
diff --git a/tests/LightyTest.pm b/tests/LightyTest.pm index e619051b..89272c4f 100755 --- a/tests/LightyTest.pm +++ b/tests/LightyTest.pm @@ -150,7 +150,7 @@ sub handle_http { close $remote; my $href; - foreach $href (@response) { + foreach $href ( @{ $t->{RESPONSE} }) { # first line is always response header my %resp_hdr; my $resp_body; @@ -187,7 +187,13 @@ sub handle_http { # check length if (defined $resp_hdr{"content-length"}) { - ($resp_body, $lines) = split("^.".$resp_hdr{"content-length"}, $lines, 2); + $resp_body = substr($lines, 0, $resp_hdr{"content-length"}); + if (length($lines) < $resp_hdr{"content-length"}) { + $lines = ""; + } else { + $lines = substr($lines, $resp_hdr{"content-length"}); + } + undef $lines if (length($lines) == 0); } else { $resp_body = $lines; undef $lines; diff --git a/tests/Makefile.am b/tests/Makefile.am index ba04ca8b..35266838 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -29,6 +29,7 @@ CONFS=fastcgi-10.conf \ core-condition.t \ core-request.t \ core-response.t \ + core-keepalive.t \ core.t \ mod-access.t \ mod-auth.t \ @@ -40,7 +41,8 @@ CONFS=fastcgi-10.conf \ mod-rewrite.t \ request.t \ mod-ssi.t \ - LightyTest.pm + LightyTest.pm \ + mod-setenv.t TESTS_ENVIRONMENT=$(srcdir)/wrapper.sh $(srcdir) $(top_builddir) diff --git a/tests/core-condition.t b/tests/core-condition.t index 92945413..5f7d1cbd 100755 --- a/tests/core-condition.t +++ b/tests/core-condition.t @@ -22,7 +22,7 @@ GET /index.html HTTP/1.0 Host: www.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/match_1" } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/match_1" } ]; ok($tf->handle_http($t) == 0, 'config deny'); $t->{REQUEST} = ( <<EOF @@ -30,7 +30,7 @@ GET /index.html HTTP/1.0 Host: test1.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/match_2" } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/match_2" } ]; ok($tf->handle_http($t) == 0, '2nd child of chaining'); $t->{REQUEST} = ( <<EOF @@ -38,7 +38,7 @@ GET /index.html HTTP/1.0 Host: test2.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/match_3" } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/match_3" } ]; ok($tf->handle_http($t) == 0, '3rd child of chaining'); $t->{REQUEST} = ( <<EOF @@ -46,7 +46,7 @@ GET /index.html HTTP/1.0 Host: test3.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/match_5" } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/match_5" } ]; ok($tf->handle_http($t) == 0, 'nesting'); ok($tf->stop_proc == 0, "Stopping lighttpd"); @@ -59,7 +59,7 @@ GET /nofile.png HTTP/1.0 Host: www.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; ok($tf->handle_http($t) == 0, 'condition: Referer - no referer'); $t->{REQUEST} = ( <<EOF @@ -68,7 +68,7 @@ Host: www.example.org Referer: http://www.example.org/ EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; ok($tf->handle_http($t) == 0, 'condition: Referer - referer matches regex'); $t->{REQUEST} = ( <<EOF @@ -77,7 +77,7 @@ Host: www.example.org Referer: http://123.example.org/ EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ]; ok($tf->handle_http($t) == 0, 'condition: Referer - referer doesn\'t match'); ok($tf->stop_proc == 0, "Stopping lighttpd"); diff --git a/tests/core-keepalive.t b/tests/core-keepalive.t new file mode 100755 index 00000000..038771d9 --- /dev/null +++ b/tests/core-keepalive.t @@ -0,0 +1,76 @@ +#! /usr/bin/perl -w + +BEGIN { + # add current source dir to the include-path + # we need this for make distcheck + (my $srcdir = $0) =~ s#/[^/]+$#/#; + unshift @INC, $srcdir; +} + +use strict; +use IO::Socket; +use Test::More tests => 6; +use LightyTest; + +my $tf = LightyTest->new(); +my $t; + +ok($tf->start_proc == 0, "Starting lighttpd") or die(); + +$t->{REQUEST} = ( <<EOF +GET /12345.txt HTTP/1.0 +Connection: keep-alive +Host: 123.example.org + +GET /12345.txt HTTP/1.0 +Host: 123.example.org +Connection: close +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } , { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; + +ok($tf->handle_http($t) == 0, 'Explicit HTTP/1.0 Keep-Alive'); + +undef $t->{RESPONSE}; + +$t->{REQUEST} = ( <<EOF +GET /12345.txt HTTP/1.0 +Connection: keep-alive +Host: 123.example.org + +GET /12345.txt HTTP/1.0 +Host: 123.example.org +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } , { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; +ok($tf->handle_http($t) == 0, 'Implicit HTTP/1.0 Keep-Alive'); + + +$t->{REQUEST} = ( <<EOF +GET /12345.txt HTTP/1.1 +Connection: keep-alive +Host: 123.example.org + +GET /12345.txt HTTP/1.1 +Host: 123.example.org +Connection: close +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } , { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ]; +ok($tf->handle_http($t) == 0, 'Explicit HTTP/1.1 Keep-Alive'); + +$t->{REQUEST} = ( <<EOF +GET /12345.txt HTTP/1.1 +Host: 123.example.org + +GET /12345.txt HTTP/1.1 +Host: 123.example.org +Connection: close +EOF + ); + +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } , { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ]; + +ok($tf->handle_http($t) == 0, 'Implicit HTTP/1.1 Keep-Alive'); + +ok($tf->stop_proc == 0, "Stopping lighttpd"); diff --git a/tests/core-request.t b/tests/core-request.t index 65ffcbec..cc6a1b07 100755 --- a/tests/core-request.t +++ b/tests/core-request.t @@ -22,14 +22,14 @@ $t->{REQUEST} = ( <<EOF GET /index%2ehtml HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'URL-encoding'); $t->{REQUEST} = ( <<EOF GET /index.html%00 HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; ok($tf->handle_http($t) == 0, 'URL-encoding, %00'); @@ -41,7 +41,7 @@ GET / HTTP/1.0 Host: www.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'hostname'); $t->{REQUEST} = ( <<EOF @@ -49,7 +49,7 @@ GET / HTTP/1.0 Host: 127.0.0.1 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'IPv4 address'); $t->{REQUEST} = ( <<EOF @@ -57,7 +57,7 @@ GET / HTTP/1.0 Host: [::1] EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'IPv6 address'); $t->{REQUEST} = ( <<EOF @@ -65,7 +65,7 @@ GET / HTTP/1.0 Host: www.example.org:80 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'hostname + port'); $t->{REQUEST} = ( <<EOF @@ -73,7 +73,7 @@ GET / HTTP/1.0 Host: 127.0.0.1:80 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'IPv4 address + port'); $t->{REQUEST} = ( <<EOF @@ -81,7 +81,7 @@ GET / HTTP/1.0 Host: [::1]:80 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'IPv6 address + port'); $t->{REQUEST} = ( <<EOF @@ -89,7 +89,7 @@ GET / HTTP/1.0 Host: ../123.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'directory traversal'); $t->{REQUEST} = ( <<EOF @@ -97,7 +97,7 @@ GET / HTTP/1.0 Host: .jsdh.sfdg.sdfg. EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'leading and trailing dot'); $t->{REQUEST} = ( <<EOF @@ -105,7 +105,7 @@ GET / HTTP/1.0 Host: jsdh.sfdg.sdfg. EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'trailing dot is ok'); $t->{REQUEST} = ( <<EOF @@ -113,7 +113,7 @@ GET / HTTP/1.0 Host: .jsdh.sfdg.sdfg EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'leading dot'); @@ -122,7 +122,7 @@ GET / HTTP/1.0 Host: jsdh..sfdg.sdfg EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'two dots'); $t->{REQUEST} = ( <<EOF @@ -130,7 +130,7 @@ GET / HTTP/1.0 Host: jsdh.sfdg.sdfg:asd EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'broken port-number'); $t->{REQUEST} = ( <<EOF @@ -138,7 +138,7 @@ GET / HTTP/1.0 Host: jsdh.sfdg.sdfg:-1 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'negative port-number'); @@ -147,7 +147,7 @@ GET / HTTP/1.0 Host: :80 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'port given but host missing'); $t->{REQUEST} = ( <<EOF @@ -155,7 +155,7 @@ GET / HTTP/1.0 Host: .jsdh.sfdg.:sdfg. EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'port and host are broken'); $t->{REQUEST} = ( <<EOF @@ -163,7 +163,7 @@ GET / HTTP/1.0 Host: a.b-c.d123 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'allowed characters in host-name'); $t->{REQUEST} = ( <<EOF @@ -171,7 +171,7 @@ GET / HTTP/1.0 Host: -a.c EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'leading dash'); $t->{REQUEST} = ( <<EOF @@ -179,7 +179,7 @@ GET / HTTP/1.0 Host: . EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'dot only'); $t->{REQUEST} = ( <<EOF @@ -187,7 +187,7 @@ GET / HTTP/1.0 Host: a192.168.2.10:1234 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'broken IPv4 address - non-digit'); $t->{REQUEST} = ( <<EOF @@ -195,7 +195,7 @@ GET / HTTP/1.0 Host: 192.168.2:1234 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'broken IPv4 address - too short'); @@ -208,7 +208,7 @@ GET /index.html HTTP/1.0 Content-Length: -2 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'negative Content-Length'); $t->{REQUEST} = ( <<EOF @@ -217,7 +217,7 @@ Host: 123.example.org Content-Length: 2147483648 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 413 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 413 } ]; ok($tf->handle_http($t) == 0, 'Content-Length > max-request-size'); $t->{REQUEST} = ( <<EOF @@ -226,7 +226,7 @@ Host: 123.example.org Content-Length: EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 411 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 411 } ]; ok($tf->handle_http($t) == 0, 'Content-Length is empty'); print "\nLow-Level Request-Header Parsing - HTTP/1.1\n"; @@ -234,7 +234,7 @@ $t->{REQUEST} = ( <<EOF GET / HTTP/1.1 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'Host missing'); print "\nContent-Type\n"; @@ -242,21 +242,21 @@ $t->{REQUEST} = ( <<EOF GET /image.jpg HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Type' => 'image/jpeg' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Type' => 'image/jpeg' } ]; ok($tf->handle_http($t) == 0, 'Content-Type - image/jpeg'); $t->{REQUEST} = ( <<EOF GET /image.JPG HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Type' => 'image/jpeg' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Type' => 'image/jpeg' } ]; ok($tf->handle_http($t) == 0, 'Content-Type - image/jpeg'); $t->{REQUEST} = ( <<EOF GET /a HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Type' => 'application/octet-stream' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Type' => 'application/octet-stream' } ]; ok($tf->handle_http($t) == 0, 'Content-Type - unknown'); diff --git a/tests/core-response.t b/tests/core-response.t index 21c9a137..7988383e 100755 --- a/tests/core-response.t +++ b/tests/core-response.t @@ -25,28 +25,28 @@ Host: www.example.org Connection: close EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, '+Date' => '' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, '+Date' => '' } ]; ok($tf->handle_http($t) == 0, 'Date header'); $t->{REQUEST} = ( <<EOF GET / HTTP/1.1 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 400, 'Connection' => 'close' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 400, 'Connection' => 'close' } ]; ok($tf->handle_http($t) == 0, 'Host missing'); $t->{REQUEST} = ( <<EOF GET / HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+ETag' => '' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+ETag' => '' } ]; ok($tf->handle_http($t) == 0, 'ETag is set'); $t->{REQUEST} = ( <<EOF GET / HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'ETag' => '/^".+"$/' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'ETag' => '/^".+"$/' } ]; ok($tf->handle_http($t) == 0, 'ETag has quotes'); @@ -59,7 +59,7 @@ GET /12345.html HTTP/1.0 Host: 123.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Length' => '6' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Length' => '6' } ]; ok($tf->handle_http($t) == 0, 'Content-Length for text/html'); $t->{REQUEST} = ( <<EOF @@ -67,7 +67,7 @@ GET /12345.txt HTTP/1.0 Host: 123.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Length' => '6' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Length' => '6' } ]; ok($tf->handle_http($t) == 0, 'Content-Length for text/plain'); @@ -77,14 +77,14 @@ $t->{REQUEST} = ( <<EOF GET /dummydir HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:2048/dummydir/' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:2048/dummydir/' } ]; ok($tf->handle_http($t) == 0, 'internal redirect in directory'); $t->{REQUEST} = ( <<EOF GET /dummydir?foo HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:2048/dummydir/?foo' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:2048/dummydir/?foo' } ]; ok($tf->handle_http($t) == 0, 'internal redirect in directory + querystring'); ## simple-vhost @@ -94,7 +94,7 @@ GET /12345.txt HTTP/1.0 Host: no-simple.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Length' => '6' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Length' => '6' } ]; ok($tf->handle_http($t) == 0, 'disabling simple-vhost via conditionals'); $t->{REQUEST} = ( <<EOF @@ -102,7 +102,7 @@ GET /12345.txt HTTP/1.0 Host: simple.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; ok($tf->handle_http($t) == 0, 'simple-vhost via conditionals'); ok($tf->stop_proc == 0, "Stopping lighttpd"); diff --git a/tests/core-var-include.t b/tests/core-var-include.t index 32830e07..1490637b 100755 --- a/tests/core-var-include.t +++ b/tests/core-var-include.t @@ -21,7 +21,7 @@ $tf->{CONFIGFILE} = 'var-include.conf'; ok($tf->start_proc == 0, "Starting lighttpd") or die(); $t->{REQUEST} = ( "GET /index.html HTTP/1.0\r\nHost: www.example.org\r\n" ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/redirect" } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => "/redirect" } ]; ok($tf->handle_http($t) == 0, 'basic test'); my $myvar = "good"; @@ -54,7 +54,7 @@ GET /$test HTTP/1.0 Host: $server_name EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => $expect } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => $expect } ]; ok($tf->handle_http($t) == 0, $test); } diff --git a/tests/core.t b/tests/core.t index 89e12c0a..93566c6f 100755 --- a/tests/core.t +++ b/tests/core.t @@ -21,49 +21,49 @@ $t->{REQUEST} = ( <<EOF GET / HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'Valid HTTP/1.0 Request') or die(); $t->{REQUEST} = ( <<EOF GET / EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'missing Protocol'); $t->{REQUEST} = ( <<EOF BC / EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'missing protocol + unknown method'); $t->{REQUEST} = ( <<EOF ABC EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'missing protocol + unknown method + missing URI'); $t->{REQUEST} = ( <<EOF ABC / HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 501 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 501 } ]; ok($tf->handle_http($t) == 0, 'unknown method'); $t->{REQUEST} = ( <<EOF GET / HTTP/1.3 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 505 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 505 } ]; ok($tf->handle_http($t) == 0, 'unknown protocol'); $t->{REQUEST} = ( <<EOF GET http://www.example.org/ HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'absolute URI'); print "\nLow-Level Request-Header Parsing\n"; @@ -72,7 +72,7 @@ GET / HTTP/1.0 ABC : foo EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'whitespace after key'); $t->{REQUEST} = ( <<EOF @@ -80,7 +80,7 @@ GET / HTTP/1.0 ABC a: foo EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'whitespace with-in key'); $t->{REQUEST} = ( <<EOF @@ -88,7 +88,7 @@ GET / HTTP/1.0 ABC:foo EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'no whitespace'); $t->{REQUEST} = ( <<EOF @@ -97,7 +97,7 @@ ABC:foo bc EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'line-folding'); print "\nLow-Level Request-Header Parsing - URI\n"; @@ -105,21 +105,21 @@ $t->{REQUEST} = ( <<EOF GET /index%2ehtml HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'URL-encoding'); $t->{REQUEST} = ( <<EOF GET /index.html%00 HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; ok($tf->handle_http($t) == 0, 'URL-encoding, %00'); $t->{REQUEST} = ( <<EOF OPTIONS * HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'OPTIONS'); $t->{REQUEST} = ( <<EOF @@ -128,7 +128,7 @@ Host: www.example.org Connection: close EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'OPTIONS'); diff --git a/tests/docroot/www/Makefile.am b/tests/docroot/www/Makefile.am index 017d3908..3336b1be 100644 --- a/tests/docroot/www/Makefile.am +++ b/tests/docroot/www/Makefile.am @@ -1,4 +1,4 @@ EXTRA_DIST=cgi.php cgi.pl dummydir index.html index.txt phpinfo.php \ phpself.php redirect.php cgi-pathinfo.pl phphost.php pathinfo.php \ - nph-status.pl prefix.fcgi get-header.pl ssi.shtml + nph-status.pl prefix.fcgi get-header.pl ssi.shtml get-post-len.pl SUBDIRS=go indexfile expire diff --git a/tests/docroot/www/get-post-len.pl b/tests/docroot/www/get-post-len.pl new file mode 100644 index 00000000..bac8bbf8 --- /dev/null +++ b/tests/docroot/www/get-post-len.pl @@ -0,0 +1,15 @@ +#!/usr/bin/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/lighttpd.conf b/tests/lighttpd.conf index a3ff70a9..d217a540 100644 --- a/tests/lighttpd.conf +++ b/tests/lighttpd.conf @@ -65,7 +65,7 @@ mimetype.assign = ( ".png" => "image/png", compress.cache-dir = "@SRCDIR@/tmp/lighttpd/cache/compress/" compress.filetype = ("text/plain", "text/html") -setenv.add-environment = ( "TRAC_ENV" => "foo") +setenv.add-environment = ( "TRAC_ENV" => "tracenv", "SETENV" => "setenv") setenv.add-request-header = ( "FOO" => "foo") setenv.add-response-header = ( "BAR" => "foo") diff --git a/tests/mod-access.t b/tests/mod-access.t index 44dc6219..84f4e8ac 100755 --- a/tests/mod-access.t +++ b/tests/mod-access.t @@ -20,7 +20,7 @@ $t->{REQUEST} = ( <<EOF GET /index.html~ HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ]; ok($tf->handle_http($t) == 0, 'forbid access to ...~'); ok($tf->stop_proc == 0, "Stopping lighttpd"); diff --git a/tests/mod-auth.t b/tests/mod-auth.t index 66593c05..89ea626b 100755 --- a/tests/mod-auth.t +++ b/tests/mod-auth.t @@ -20,7 +20,7 @@ $t->{REQUEST} = ( <<EOF GET /server-status HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ]; ok($tf->handle_http($t) == 0, 'Missing Auth-token'); $t->{REQUEST} = ( <<EOF @@ -28,7 +28,7 @@ GET /server-status HTTP/1.0 Authorization: Basic amFuOmphb EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ]; ok($tf->handle_http($t) == 0, 'Basic-Auth: Wrong Auth-token'); $t->{REQUEST} = ( <<EOF @@ -36,7 +36,7 @@ GET /server-config HTTP/1.0 Authorization: Basic amFuOmphbg== EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token'); ## this should not crash @@ -47,7 +47,7 @@ Authorization: Digest username="jan", realm="jan", nonce="9a5428ccc05b086a08d918 uri="/server-status", response="ea5f7d9a30b8b762f9610ccb87dea74f" EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ]; ok($tf->handle_http($t) == 0, 'Digest-Auth: missing qop, no crash'); diff --git a/tests/mod-cgi.t b/tests/mod-cgi.t index fbfe3f70..5d2891db 100755 --- a/tests/mod-cgi.t +++ b/tests/mod-cgi.t @@ -8,7 +8,7 @@ BEGIN { use strict; use IO::Socket; -use Test::More tests => 12; +use Test::More tests => 15; use LightyTest; my $tf = LightyTest->new(); @@ -22,43 +22,65 @@ $t->{REQUEST} = ( <<EOF GET /cgi.pl HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'perl via cgi'); $t->{REQUEST} = ( <<EOF GET /cgi.pl/foo HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/cgi.pl' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/cgi.pl' } ]; ok($tf->handle_http($t) == 0, 'perl via cgi + pathinfo'); $t->{REQUEST} = ( <<EOF GET /cgi-pathinfo.pl/foo HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/foo' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/foo' } ]; ok($tf->handle_http($t) == 0, 'perl via cgi + pathinfo'); $t->{REQUEST} = ( <<EOF GET /nph-status.pl HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'NPH + perl, Bug #14'); $t->{REQUEST} = ( <<EOF GET /get-header.pl?GATEWAY_INTERFACE HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'CGI/1.1' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'CGI/1.1' } ]; ok($tf->handle_http($t) == 0, 'cgi-env: GATEWAY_INTERFACE'); +$t->{REQUEST} = ( <<EOF +GET /get-header.pl?QUERY_STRING HTTP/1.0 +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'QUERY_STRING' } ]; +ok($tf->handle_http($t) == 0, 'cgi-env: QUERY_STRING'); + +$t->{REQUEST} = ( <<EOF +GET /get-header.pl?GATEWAY_INTERFACE HTTP/1.0 +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'CGI/1.1' } ]; +ok($tf->handle_http($t) == 0, 'cgi-env: GATEWAY_INTERFACE'); + +$t->{REQUEST} = ( <<EOF +GET /get-header.pl?HTTP_HOST HTTP/1.0 +Host: www.example.org +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } ]; +ok($tf->handle_http($t) == 0, 'cgi-env: HTTP_HOST'); + $t->{REQUEST} = ( <<EOF GET /get-header.pl?HTTP_XX_YY123 HTTP/1.0 xx-yy123: foo EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'foo' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'foo' } ]; ok($tf->handle_http($t) == 0, 'cgi-env: quoting headers with numbers'); $t->{REQUEST} = ( <<EOF @@ -66,7 +88,7 @@ GET /get-header.pl?HTTP_HOST HTTP/1.0 Host: www.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } ]; ok($tf->handle_http($t) == 0, 'cgi-env: HTTP_HOST'); $t->{REQUEST} = ( <<EOF @@ -74,7 +96,7 @@ GET /get-header.pl?HTTP_HOST HTTP/1.0 Host: www.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } ]; ok($tf->handle_http($t) == 0, 'cgi-env: HTTP_HOST'); $t->{REQUEST} = ( <<EOF @@ -82,7 +104,7 @@ GET /get-header.pl?HTTP_HOST HTTP/1.0 Host: www.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Type' => 'text/plain' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Type' => 'text/plain' } ]; ok($tf->handle_http($t) == 0, 'cgi-env: HTTP_HOST'); $t->{REQUEST} = ( <<EOF @@ -91,7 +113,7 @@ Host: www.example.org Connection: close EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, '+Content-Length' => '' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, '+Content-Length' => '' } ]; ok($tf->handle_http($t) == 0, 'cgi-env: HTTP_HOST'); ok($tf->stop_proc == 0, "Stopping lighttpd"); diff --git a/tests/mod-compress.t b/tests/mod-compress.t index 41b2299e..e36d1ef2 100755 --- a/tests/mod-compress.t +++ b/tests/mod-compress.t @@ -21,7 +21,7 @@ GET /index.html HTTP/1.0 Accept-Encoding: deflate EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '' } ]; ok($tf->handle_http($t) == 0, 'Vary is set'); $t->{REQUEST} = ( <<EOF @@ -29,7 +29,7 @@ GET /index.html HTTP/1.0 Accept-Encoding: deflate EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1288', '+Content-Encoding' => '' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1288', '+Content-Encoding' => '' } ]; ok($tf->handle_http($t) == 0, 'deflate - Content-Length and Content-Encoding is set'); $t->{REQUEST} = ( <<EOF @@ -37,7 +37,7 @@ GET /index.html HTTP/1.0 Accept-Encoding: gzip EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', '+Content-Encoding' => '' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', '+Content-Encoding' => '' } ]; ok($tf->handle_http($t) == 0, 'gzip - Content-Length and Content-Encoding is set'); $t->{REQUEST} = ( <<EOF @@ -45,7 +45,7 @@ GET /index.txt HTTP/1.0 Accept-Encoding: gzip, deflate EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', '+Content-Encoding' => '' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', '+Content-Encoding' => '' } ]; ok($tf->handle_http($t) == 0, 'gzip, deflate - Content-Length and Content-Encoding is set'); $t->{REQUEST} = ( <<EOF @@ -53,7 +53,7 @@ GET /index.txt HTTP/1.0 Accept-Encoding: gzip, deflate EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', '+Content-Encoding' => '', 'Content-Type' => "text/plain" } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', '+Content-Encoding' => '', 'Content-Type' => "text/plain" } ]; ok($tf->handle_http($t) == 0, 'Content-Type is from the original file'); diff --git a/tests/mod-fastcgi.t b/tests/mod-fastcgi.t index 34e3c1b7..8bcf81fd 100755 --- a/tests/mod-fastcgi.t +++ b/tests/mod-fastcgi.t @@ -24,7 +24,7 @@ GET /phpinfo.php HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'valid request'); $t->{REQUEST} = ( <<EOF @@ -32,7 +32,7 @@ GET /phpinfofoobar.php HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; ok($tf->handle_http($t) == 0, 'file not found'); $t->{REQUEST} = ( <<EOF @@ -40,7 +40,7 @@ GET /go/ HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'index-file handling'); $t->{REQUEST} = ( <<EOF @@ -48,7 +48,7 @@ GET /redirect.php HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 302, 'Location' => 'http://www.example.org:2048/' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 302, 'Location' => 'http://www.example.org:2048/' } ]; ok($tf->handle_http($t) == 0, 'Status + Location via FastCGI'); $t->{REQUEST} = ( <<EOF @@ -56,7 +56,7 @@ GET /phpself.php HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, '$_SERVER["PHP_SELF"]'); $t->{REQUEST} = ( <<EOF @@ -64,7 +64,7 @@ GET /phpself.php/foo HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/phpself.php' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/phpself.php' } ]; ok($tf->handle_http($t) == 0, '$_SERVER["PHP_SELF"]'); $t->{REQUEST} = ( <<EOF @@ -72,7 +72,7 @@ GET /pathinfo.php/foo HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/foo' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/foo' } ]; ok($tf->handle_http($t) == 0, '$_SERVER["PATH_INFO"]'); $t->{REQUEST} = ( <<EOF @@ -80,7 +80,7 @@ GET /phphost.php HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } ]; ok($tf->handle_http($t) == 0, 'SERVER_NAME'); $t->{REQUEST} = ( <<EOF @@ -88,7 +88,7 @@ GET /phphost.php HTTP/1.0 Host: foo.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } ]; ok($tf->handle_http($t) == 0, 'SERVER_NAME'); $t->{REQUEST} = ( <<EOF @@ -96,7 +96,7 @@ GET /phphost.php HTTP/1.0 Host: vvv.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } ]; ok($tf->handle_http($t) == 0, 'SERVER_NAME'); $t->{REQUEST} = ( <<EOF @@ -104,49 +104,49 @@ GET /phphost.php HTTP/1.0 Host: zzz.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'www.example.org' } ]; ok($tf->handle_http($t) == 0, 'SERVER_NAME'); $t->{REQUEST} = ( <<EOF GET /cgi.php/abc HTTP/1.0 EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'PATHINFO'); $t->{REQUEST} = ( <<EOF GET /www/abc/def HTTP/1.0 EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; ok($tf->handle_http($t) == 0, 'PATHINFO on a directory'); $t->{REQUEST} = ( <<EOF GET /indexfile/ HTTP/1.0 EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/indexfile/index.php' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/indexfile/index.php' } ]; ok($tf->handle_http($t) == 0, 'PHP_SELF + Indexfile, Bug #3'); $t->{REQUEST} = ( <<EOF GET /prefix.fcgi?var=SCRIPT_NAME HTTP/1.0 EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/prefix.fcgi' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/prefix.fcgi' } ]; ok($tf->handle_http($t) == 0, 'PATH_INFO, check-local off'); $t->{REQUEST} = ( <<EOF GET /prefix.fcgi/foo/bar?var=SCRIPT_NAME HTTP/1.0 EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/prefix.fcgi' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/prefix.fcgi' } ]; ok($tf->handle_http($t) == 0, 'PATH_INFO, check-local off'); $t->{REQUEST} = ( <<EOF GET /prefix.fcgi/foo/bar?var=PATH_INFO HTTP/1.0 EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/foo/bar' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/foo/bar' } ]; ok($tf->handle_http($t) == 0, 'PATH_INFO, check-local off'); @@ -160,7 +160,7 @@ GET /phphost.php HTTP/1.0 Host: zzz.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'zzz.example.org' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'zzz.example.org' } ]; ok($tf->handle_http($t) == 0, 'FastCGI + Host'); ok($tf->stop_proc == 0, "Stopping lighttpd"); @@ -172,7 +172,7 @@ GET /indexfile/ HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/indexfile/index.php' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/indexfile/index.php' } ]; ok($tf->handle_http($t) == 0, 'Bug #6'); ok($tf->stop_proc == 0, "Stopping lighttpd"); @@ -185,7 +185,7 @@ Host: www.example.org Content-Length: 0 EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'HTTP-Content' => '/indexfile/return-404.php' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, 'HTTP-Content' => '/indexfile/return-404.php' } ]; ok($tf->handle_http($t) == 0, 'Bug #12'); ok($tf->stop_proc == 0, "Stopping lighttpd"); @@ -201,7 +201,7 @@ GET /index.html?ok HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'FastCGI - Auth'); $t->{REQUEST} = ( <<EOF @@ -209,7 +209,7 @@ GET /index.html?fail HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ]; ok($tf->handle_http($t) == 0, 'FastCGI - Auth'); ok($tf->stop_proc == 0, "Stopping lighttpd"); @@ -224,7 +224,7 @@ GET /indexfile/index.php HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'FastCGI + local spawning'); ok($tf->stop_proc == 0, "Stopping lighttpd"); @@ -241,7 +241,7 @@ GET /index.fcgi?lf HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } ]; ok($tf->handle_http($t) == 0, 'line-ending \n\n'); $t->{REQUEST} = ( <<EOF @@ -249,7 +249,7 @@ GET /index.fcgi?crlf HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } ]; ok($tf->handle_http($t) == 0, 'line-ending \r\n\r\n'); $t->{REQUEST} = ( <<EOF @@ -257,7 +257,7 @@ GET /index.fcgi?slow-lf HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } ]; ok($tf->handle_http($t) == 0, 'line-ending \n + \n'); $t->{REQUEST} = ( <<EOF @@ -265,7 +265,7 @@ GET /index.fcgi?slow-crlf HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } ]; ok($tf->handle_http($t) == 0, 'line-ending \r\n + \r\n'); $t->{REQUEST} = ( <<EOF @@ -273,7 +273,7 @@ GET /index.fcgi?die-at-end HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } ]; ok($tf->handle_http($t) == 0, 'killing fastcgi and wait for restart'); $t->{REQUEST} = ( <<EOF @@ -281,7 +281,7 @@ GET /index.fcgi?die-at-end HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } ]; ok($tf->handle_http($t) == 0, 'killing fastcgi and wait for restart'); @@ -290,7 +290,7 @@ GET /index.fcgi?crlf HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } ]; ok($tf->handle_http($t) == 0, 'regular response of after restart'); diff --git a/tests/mod-proxy.t b/tests/mod-proxy.t index 2f53ddc3..782df92d 100755 --- a/tests/mod-proxy.t +++ b/tests/mod-proxy.t @@ -37,7 +37,7 @@ GET /index.html HTTP/1.0 Host: www.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf_proxy->handle_http($t) == 0, 'valid request'); $t->{REQUEST} = ( <<EOF @@ -45,7 +45,7 @@ GET /index.html HTTP/1.0 Host: www.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Server' => 'Proxy' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Server' => 'Proxy' } ]; ok($tf_proxy->handle_http($t) == 0, 'drop Server from real server'); ok($tf_proxy->stop_proc == 0, "Stopping lighttpd proxy"); diff --git a/tests/mod-redirect.t b/tests/mod-redirect.t index 690acdd0..99f95967 100755 --- a/tests/mod-redirect.t +++ b/tests/mod-redirect.t @@ -21,7 +21,7 @@ GET /redirect/ HTTP/1.0 Host: vvv.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:2048/' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:2048/' } ]; ok($tf->handle_http($t) == 0, 'external redirect'); $t->{REQUEST} = ( <<EOF @@ -29,7 +29,7 @@ GET /redirect/ HTTP/1.0 Host: zzz.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:2048/zzz' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:2048/zzz' } ]; ok($tf->handle_http($t) == 0, 'external redirect with cond regsub'); $t->{REQUEST} = ( <<EOF @@ -37,7 +37,7 @@ GET /redirect/ HTTP/1.0 Host: remoteip.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:2048/127.0.0.1' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:2048/127.0.0.1' } ]; ok($tf->handle_http($t) == 0, 'external redirect with cond regsub on remoteip'); $t->{REQUEST} = ( <<EOF @@ -45,7 +45,7 @@ GET /redirect/ HTTP/1.0 Host: remoteip2.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:2048/remoteip2' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:2048/remoteip2' } ]; ok($tf->handle_http($t) == 0, 'external redirect with cond regsub on remoteip2'); ok($tf->stop_proc == 0, "Stopping lighttpd"); diff --git a/tests/mod-rewrite.t b/tests/mod-rewrite.t index 668c1a36..546d1b81 100755 --- a/tests/mod-rewrite.t +++ b/tests/mod-rewrite.t @@ -25,7 +25,7 @@ GET /rewrite/foo HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '' } ]; ok($tf->handle_http($t) == 0, 'valid request'); $t->{REQUEST} = ( <<EOF @@ -33,7 +33,7 @@ GET /rewrite/foo?a=b HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'a=b' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'a=b' } ]; ok($tf->handle_http($t) == 0, 'valid request'); $t->{REQUEST} = ( <<EOF @@ -41,7 +41,7 @@ GET /rewrite/bar?a=b HTTP/1.0 Host: www.example.org EOF ); - $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'bar&a=b' } ); + $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'bar&a=b' } ]; ok($tf->handle_http($t) == 0, 'valid request'); ok($tf->stop_proc == 0, "Stopping lighttpd"); diff --git a/tests/mod-secdownload.t b/tests/mod-secdownload.t index 46cfc7b3..cd13a139 100755 --- a/tests/mod-secdownload.t +++ b/tests/mod-secdownload.t @@ -27,7 +27,7 @@ GET /sec/$m/$thex$f HTTP/1.0 Host: vvv.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'secdownload'); @@ -39,7 +39,7 @@ GET /sec/$m/$thex$f HTTP/1.0 Host: vvv.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 408 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 408 } ]; ok($tf->handle_http($t) == 0, 'secdownload - timeout'); @@ -48,7 +48,7 @@ GET /sec$f HTTP/1.0 Host: vvv.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; ok($tf->handle_http($t) == 0, 'secdownload - direct access'); @@ -57,7 +57,7 @@ GET $f HTTP/1.0 Host: www.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'secdownload - conditional access'); @@ -71,7 +71,7 @@ GET /sec/$m/$thex$f HTTP/1.0 Host: vvv.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; ok($tf->handle_http($t) == 0, 'secdownload - timeout'); diff --git a/tests/mod-setenv.t b/tests/mod-setenv.t new file mode 100755 index 00000000..cd902f96 --- /dev/null +++ b/tests/mod-setenv.t @@ -0,0 +1,53 @@ +#! /usr/bin/perl -w + +BEGIN { + # add current source dir to the include-path + # we need this for make distcheck + (my $srcdir = $0) =~ s#/[^/]+$#/#; + unshift @INC, $srcdir; +} + +use strict; +use IO::Socket; +use Test::More tests => 6; +use LightyTest; + +my $tf = LightyTest->new(); +my $t; + +ok($tf->start_proc == 0, "Starting lighttpd") or die(); + +$t->{REQUEST} = ( <<EOF +GET /get-header.pl?TRAC_ENV HTTP/1.0 +Host: www.example.org +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'tracenv' } ]; +ok($tf->handle_http($t) == 0, 'query first setenv'); + +$t->{REQUEST} = ( <<EOF +GET /get-header.pl?SETENV HTTP/1.0 +Host: www.example.org +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'setenv' } ]; +ok($tf->handle_http($t) == 0, 'query second setenv'); + +$t->{REQUEST} = ( <<EOF +GET /get-header.pl?HTTP_FOO HTTP/1.0 +Host: www.example.org +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'foo' } ]; +ok($tf->handle_http($t) == 0, 'query add-request-header'); + +$t->{REQUEST} = ( <<EOF +GET /index.html HTTP/1.0 +Host: www.example.org +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'BAR' => 'foo' } ]; +ok($tf->handle_http($t) == 0, 'query add-response-header'); + +ok($tf->stop_proc == 0, "Stopping lighttpd"); + diff --git a/tests/mod-ssi.t b/tests/mod-ssi.t index 72b2a096..7609d349 100755 --- a/tests/mod-ssi.t +++ b/tests/mod-ssi.t @@ -22,7 +22,7 @@ $t->{REQUEST} = ( <<EOF GET /ssi.shtml HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => "/ssi.shtml\n" } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => "/ssi.shtml\n" } ]; ok($tf->handle_http($t) == 0, 'ssi - echo '); ok($tf->stop_proc == 0, "Stopping lighttpd"); diff --git a/tests/mod-userdir.t b/tests/mod-userdir.t index 1c669942..890e73aa 100755 --- a/tests/mod-userdir.t +++ b/tests/mod-userdir.t @@ -22,14 +22,14 @@ $t->{REQUEST} = ( <<EOF GET /~foobar/ HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; ok($tf->handle_http($t) == 0, 'valid user'); $t->{REQUEST} = ( <<EOF GET /~jan HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:2048/~jan/' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:2048/~jan/' } ]; ok($tf->handle_http($t) == 0, 'valid user + redirect'); $t->{REQUEST} = ( <<EOF @@ -37,7 +37,7 @@ GET /~jan HTTP/1.0 Host: www.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://www.example.org/~jan/' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://www.example.org/~jan/' } ]; ok($tf->handle_http($t) == 0, 'valid user + redirect'); ok($tf->stop_proc == 0, "Stopping lighttpd"); diff --git a/tests/request.t b/tests/request.t index 4ee9bbca..f82c2e50 100755 --- a/tests/request.t +++ b/tests/request.t @@ -22,14 +22,14 @@ $t->{REQUEST} = ( <<EOF GET /foobar HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; ok($tf->handle_http($t) == 0, 'file not found'); $t->{REQUEST} = ( <<EOF GET /foobar?foobar HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; ok($tf->handle_http($t) == 0, 'file not found + querystring'); $t->{REQUEST} = ( <<EOF @@ -37,7 +37,7 @@ GET /12345.txt HTTP/1.0 Host: 123.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain' } ]; ok($tf->handle_http($t) == 0, 'GET, content == 12345, mimetype text/plain'); $t->{REQUEST} = ( <<EOF @@ -45,7 +45,7 @@ GET /12345.html HTTP/1.0 Host: 123.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/html' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/html' } ]; ok($tf->handle_http($t) == 0, 'GET, content == 12345, mimetype text/html'); $t->{REQUEST} = ( <<EOF @@ -53,14 +53,14 @@ GET /dummyfile.bla HTTP/1.0 Host: 123.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'application/octet-stream' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'application/octet-stream' } ]; ok($tf->handle_http($t) == 0, 'GET, content == 12345, mimetype application/octet-stream'); $t->{REQUEST} = ( <<EOF POST / HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 411 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 411 } ]; ok($tf->handle_http($t) == 0, 'POST request, no Content-Length'); @@ -70,14 +70,14 @@ Content-type: application/x-www-form-urlencoded Content-length: 0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'POST request, empty request-body'); $t->{REQUEST} = ( <<EOF HEAD / HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '-HTTP-Content' => ''} ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '-HTTP-Content' => ''} ]; ok($tf->handle_http($t) == 0, 'HEAD request, no content'); $t->{REQUEST} = ( <<EOF @@ -85,14 +85,14 @@ HEAD /12345.html HTTP/1.0 Host: 123.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '-HTTP-Content' => '', 'Content-Type' => 'text/html', 'Content-Length' => '6'} ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '-HTTP-Content' => '', 'Content-Type' => 'text/html', 'Content-Length' => '6'} ]; ok($tf->handle_http($t) == 0, 'HEAD request, mimetype text/html, content-length'); $t->{REQUEST} = ( <<EOF HEAD /foobar?foobar HTTP/1.0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, '-HTTP-Content' => '' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, '-HTTP-Content' => '' } ]; ok($tf->handle_http($t) == 0, 'HEAD request, file-not-found, query-string'); $t->{REQUEST} = ( <<EOF @@ -101,7 +101,7 @@ Connection: close Expect: 100-continue EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 417, '-HTTP-Content' => ''} ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 417, '-HTTP-Content' => ''} ]; ok($tf->handle_http($t) == 0, 'Continue, Expect'); ## ranges @@ -112,7 +112,7 @@ Host: 123.example.org Range: bytes=0-3 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => '1234' } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => '1234' } ]; ok($tf->handle_http($t) == 0, 'GET, Range 0-3'); $t->{REQUEST} = ( <<EOF @@ -121,7 +121,7 @@ Host: 123.example.org Range: bytes=-3 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => '45'."\n" } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => '45'."\n" } ]; ok($tf->handle_http($t) == 0, 'GET, Range -3'); $t->{REQUEST} = ( <<EOF @@ -130,7 +130,7 @@ Host: 123.example.org Range: bytes=3- EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => '45'."\n" } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => '45'."\n" } ]; ok($tf->handle_http($t) == 0, 'GET, Range 3-'); $t->{REQUEST} = ( <<EOF @@ -139,7 +139,7 @@ Host: 123.example.org Range: bytes=0-1,3-4 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => <<EOF +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => <<EOF \r --fkj49sn38dcn3\r Content-Range: bytes 0-1/6\r @@ -153,7 +153,7 @@ Content-Type: text/plain\r 45\r --fkj49sn38dcn3--\r EOF - } ); + } ]; ok($tf->handle_http($t) == 0, 'GET, Range 0-1,3-4'); $t->{REQUEST} = ( <<EOF @@ -162,7 +162,7 @@ Host: 123.example.org Range: bytes=0-- EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'GET, Range 0--'); $t->{REQUEST} = ( <<EOF @@ -171,7 +171,7 @@ Host: 123.example.org Range: bytes=-2-3 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'GET, Range -2-3'); $t->{REQUEST} = ( <<EOF @@ -180,7 +180,7 @@ Host: 123.example.org Range: bytes=-0 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 416, 'HTTP-Content' => <<EOF +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 416, 'HTTP-Content' => <<EOF <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> @@ -193,7 +193,7 @@ $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 416, 'HTTP- </body> </html> EOF - } ); + } ]; ok($tf->handle_http($t) == 0, 'GET, Range -0'); $t->{REQUEST} = ( <<EOF @@ -202,7 +202,7 @@ Host: 123.example.org Range: bytes=25- EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 416, 'HTTP-Content' => <<EOF +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 416, 'HTTP-Content' => <<EOF <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> @@ -215,7 +215,7 @@ $t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 416, 'HTTP- </body> </html> EOF - } ); + } ]; ok($tf->handle_http($t) == 0, 'GET, Range start out of range'); @@ -233,7 +233,7 @@ nfj: jgfdjdfg jfue: jfdfdg EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'larger headers'); @@ -243,7 +243,7 @@ Host: www.example.org Host: 123.example.org EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'Duplicate Host headers, Bug #25'); @@ -253,7 +253,7 @@ Content-Length: 5 Content-Length: 4 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'Duplicate Content-Length headers'); $t->{REQUEST} = ( <<EOF @@ -262,7 +262,7 @@ Content-Type: 5 Content-Type: 4 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'Duplicate Content-Type headers'); $t->{REQUEST} = ( <<EOF @@ -271,7 +271,7 @@ Range: bytes=5-6 Range: bytes=5-9 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'Duplicate Range headers'); $t->{REQUEST} = ( <<EOF @@ -280,7 +280,7 @@ If-None-Match: 5 If-None-Match: 4 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'Duplicate If-None-Match headers'); $t->{REQUEST} = ( <<EOF @@ -289,7 +289,7 @@ If-Modified-Since: 5 If-Modified-Since: 4 EOF ); -$t->{RESPONSE} = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'Duplicate If-Modified-Since headers'); |