diff options
author | Arno Töll <arno@debian.org> | 2012-11-21 23:03:47 +0100 |
---|---|---|
committer | Arno Töll <arno@debian.org> | 2012-11-21 23:03:47 +0100 |
commit | a4197a3a45fd2b20d05c079d49af9fbef5fd4e2e (patch) | |
tree | 6777fddb60ecea91715e0ce39298a8366c27a40d /tests | |
parent | 0f22664a8c9f92c8b7d5dd05772bacf7caecbd52 (diff) | |
download | lighttpd-a4197a3a45fd2b20d05c079d49af9fbef5fd4e2e.tar.gz |
Imported Upstream version 1.4.16upstream/1.4.16
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/core-request.t | 34 | ||||
-rw-r--r-- | tests/docroot/www/Makefile.am | 2 | ||||
-rw-r--r-- | tests/docroot/www/Makefile.in | 2 | ||||
-rw-r--r-- | tests/docroot/www/index.html~ | 0 | ||||
-rwxr-xr-x | tests/mod-access.t | 9 | ||||
-rwxr-xr-x | tests/mod-auth.t | 39 | ||||
-rwxr-xr-x | tests/prepare.sh | 1 |
7 files changed, 82 insertions, 5 deletions
diff --git a/tests/core-request.t b/tests/core-request.t index 27edafa..fc6e25f 100755 --- a/tests/core-request.t +++ b/tests/core-request.t @@ -8,7 +8,7 @@ BEGIN { use strict; use IO::Socket; -use Test::More tests => 33; +use Test::More tests => 36; use LightyTest; my $tf = LightyTest->new(); @@ -273,6 +273,38 @@ EOF $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; ok($tf->handle_http($t) == 0, 'uppercase filenames'); +$t->{REQUEST} = ( <<EOF +GET / HTTP/1.0 +Location: foo +Location: foobar + baz +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; +ok($tf->handle_http($t) == 0, '#1232 - duplicate headers with line-wrapping'); + +$t->{REQUEST} = ( <<EOF +GET / HTTP/1.0 +Location: +Location: foobar + baz +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; +ok($tf->handle_http($t) == 0, '#1232 - duplicate headers with line-wrapping - test 2'); + +$t->{REQUEST} = ( <<EOF +GET / HTTP/1.0 +A: +Location: foobar + baz +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; +ok($tf->handle_http($t) == 0, '#1232 - duplicate headers with line-wrapping - test 3'); + + + ok($tf->stop_proc == 0, "Stopping lighttpd"); diff --git a/tests/docroot/www/Makefile.am b/tests/docroot/www/Makefile.am index 9198f56..bcbd39c 100644 --- a/tests/docroot/www/Makefile.am +++ b/tests/docroot/www/Makefile.am @@ -1,5 +1,5 @@ EXTRA_DIST=cgi.php cgi.pl dummydir index.html index.txt phpinfo.php \ redirect.php cgi-pathinfo.pl get-env.php get-server-env.php \ nph-status.pl prefix.fcgi get-header.pl ssi.shtml get-post-len.pl \ - exec-date.shtml + exec-date.shtml index.html~ SUBDIRS=go indexfile expire diff --git a/tests/docroot/www/Makefile.in b/tests/docroot/www/Makefile.in index 8e51e0c..393c611 100644 --- a/tests/docroot/www/Makefile.in +++ b/tests/docroot/www/Makefile.in @@ -196,7 +196,7 @@ top_srcdir = @top_srcdir@ EXTRA_DIST = cgi.php cgi.pl dummydir index.html index.txt phpinfo.php \ redirect.php cgi-pathinfo.pl get-env.php get-server-env.php \ nph-status.pl prefix.fcgi get-header.pl ssi.shtml get-post-len.pl \ - exec-date.shtml + exec-date.shtml index.html~ SUBDIRS = go indexfile expire all: all-recursive diff --git a/tests/docroot/www/index.html~ b/tests/docroot/www/index.html~ new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/docroot/www/index.html~ diff --git a/tests/mod-access.t b/tests/mod-access.t index fb08db4..82275df 100755 --- a/tests/mod-access.t +++ b/tests/mod-access.t @@ -8,7 +8,7 @@ BEGIN { use strict; use IO::Socket; -use Test::More tests => 3; +use Test::More tests => 4; use LightyTest; my $tf = LightyTest->new(); @@ -23,5 +23,12 @@ EOF $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ]; ok($tf->handle_http($t) == 0, 'forbid access to ...~'); +$t->{REQUEST} = ( <<EOF +GET /index.html~/ HTTP/1.0 +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ]; +ok($tf->handle_http($t) == 0, '#1230 - forbid access to ...~ - trailing slash'); + ok($tf->stop_proc == 0, "Stopping lighttpd"); diff --git a/tests/mod-auth.t b/tests/mod-auth.t index b0efbde..cfeb042 100755 --- a/tests/mod-auth.t +++ b/tests/mod-auth.t @@ -8,7 +8,7 @@ BEGIN { use strict; use IO::Socket; -use Test::More tests => 10; +use Test::More tests => 13; use LightyTest; my $tf = LightyTest->new(); @@ -93,6 +93,43 @@ EOF $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'Digest-Auth: missing nc (noncecount instead), no crash'); +$t->{REQUEST} = ( <<EOF +GET /server-status HTTP/1.0 +Authorization: Basic = +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ]; +ok($tf->handle_http($t) == 0, 'Basic-Auth: Invalid Base64'); + + +$t->{REQUEST} = ( <<EOF +GET /server-status HTTP/1.0 +User-Agent: Wget/1.9.1 +Authorization: Digest username="jan", realm="jan", + nonce="b1d12348b4620437c43dd61c50ae4639", algorithm="md5-sess", + uri="/MJ-BONG.xm.mpc", qop=auth, noncecount=00000001", + cnonce="036FCA5B86F7E7C4965C7F9B8FE714B7", + nc="asd", + response="29B32C2953C763C6D033C8A49983B87E" +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ]; +ok($tf->handle_http($t) == 0, 'Digest-Auth: md5-sess + missing cnonce'); + +$t->{REQUEST} = ( <<EOF +GET /server-status HTTP/1.0 +User-Agent: Wget/1.9.1 +Authorization: Digest username="jan", realm="jan", + nonce="b1d12348b4620437c43dd61c50ae4639", algorithm="md5-sess", + uri="/MJ-BONG.xm.mpc", qop=auth, noncecount=00000001", + cnonce="036FCA5B86F7E7C4965C7F9B8FE714B7", + nc="asd", + response="29B32C2953C763C6D033C8A49983B87E" +EOF + ); +$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ]; +ok($tf->handle_http($t) == 0, 'Digest-Auth: trailing WS'); + ok($tf->stop_proc == 0, "Stopping lighttpd"); diff --git a/tests/prepare.sh b/tests/prepare.sh index 040b6ee..900ea16 100755 --- a/tests/prepare.sh +++ b/tests/prepare.sh @@ -25,6 +25,7 @@ mkdir -p $tmpdir/cache/compress/ # copy everything into the right places cp $srcdir/docroot/www/*.html \ $srcdir/docroot/www/*.php \ + $srcdir/docroot/www/*.html~ \ $srcdir/docroot/www/*.pl \ $srcdir/docroot/www/*.fcgi \ $srcdir/docroot/www/*.shtml \ |