From bd8e6919d29ea6186bcc3c169079d2af44746821 Mon Sep 17 00:00:00 2001 From: Jan Kneschke Date: Wed, 1 Feb 2006 11:35:08 +0000 Subject: [PATCH] added tests for possible crashes git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@974 152afb58-edef-0310-8abb-c4023f1b3aa9 --- tests/mod-auth.t | 17 ++++++++++++++++- tests/mod-compress.t | 14 +++++++++++++- tests/request.t | 10 +++++++++- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/tests/mod-auth.t b/tests/mod-auth.t index f9017b2e..8500ced9 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 => 9; +use Test::More tests => 10; use LightyTest; my $tf = LightyTest->new(); @@ -79,6 +79,21 @@ EOF $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ]; ok($tf->handle_http($t) == 0, 'Digest-Auth: missing qop, no crash'); +## this should not crash +$t->{REQUEST} = ( <{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; +ok($tf->handle_http($t) == 0, 'Digest-Auth: missing nc (noncecount instead), no crash'); + + ok($tf->stop_proc == 0, "Stopping lighttpd"); diff --git a/tests/mod-compress.t b/tests/mod-compress.t index 3f1462ab..e4f110f4 100755 --- a/tests/mod-compress.t +++ b/tests/mod-compress.t @@ -8,7 +8,7 @@ BEGIN { use strict; use IO::Socket; -use Test::More tests => 9; +use Test::More tests => 10; use LightyTest; my $tf = LightyTest->new(); @@ -77,4 +77,16 @@ EOF $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'); +$t->{REQUEST} = ( <{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Type' => "text/plain" } ]; +ok($tf->handle_http($t) == 0, 'Empty Accept-Encoding'); + + ok($tf->stop_proc == 0, "Stopping lighttpd"); diff --git a/tests/request.t b/tests/request.t index be1f5d8f..e581879e 100755 --- a/tests/request.t +++ b/tests/request.t @@ -8,7 +8,7 @@ BEGIN { use strict; use IO::Socket; -use Test::More tests => 33; +use Test::More tests => 34; use LightyTest; my $tf = LightyTest->new(); @@ -320,6 +320,14 @@ EOF $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; ok($tf->handle_http($t) == 0, 'OPTIONS with Content-Length'); +$t->{REQUEST} = ( <{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ]; +ok($tf->handle_http($t) == 0, 'OPTIONS for RTSP'); + $t->{REQUEST} = ( <