summaryrefslogtreecommitdiff
path: root/tests/request.t
diff options
context:
space:
mode:
authorJan Kneschke <jan@kneschke.de>2007-08-17 21:50:05 +0000
committerJan Kneschke <jan@kneschke.de>2007-08-17 21:50:05 +0000
commit9bc4c2a02551aac82247bdc551d424618dc90dbe (patch)
tree71b91286797f4a61e33b2a76dbd4e53592cefcd4 /tests/request.t
parent8f8e23f636ed3275e632e175878de107bf092ac3 (diff)
downloadlighttpd1.4-9bc4c2a02551aac82247bdc551d424618dc90dbe.tar.gz
lighttpd1.4-9bc4c2a02551aac82247bdc551d424618dc90dbe.zip
added testcases for #1286 and #1287
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1929 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'tests/request.t')
-rwxr-xr-xtests/request.t37
1 files changed, 35 insertions, 2 deletions
diff --git a/tests/request.t b/tests/request.t
index 64e48cc3..cbc90e41 100755
--- a/tests/request.t
+++ b/tests/request.t
@@ -8,7 +8,7 @@ BEGIN {
use strict;
use IO::Socket;
-use Test::More tests => 34;
+use Test::More tests => 40;
use LightyTest;
my $tf = LightyTest->new();
@@ -338,7 +338,6 @@ EOF
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
ok($tf->handle_http($t) == 0, 'HEAD with Content-Length');
-
$t->{REQUEST} = ( <<EOF
GET / HTTP/1.0
If-Modified-Since: Sun, 1970 Jan 01 00:00:01 GMT
@@ -348,5 +347,39 @@ EOF
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
ok($tf->handle_http($t) == 0, 'Duplicate If-Mod-Since, with equal timestamps');
+$t->{REQUEST} = ( "GET / HTTP/1.0\r\nIf-Modified-Since: \0\r\n\r\n" );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
+ok($tf->handle_http($t) == 0, 'invalid chars in Header values (bug #1286)');
+
+$t->{REQUEST} = ( "GET / HTTP/1.0\r\nIf-Modified-Since: \r\n\r\n" );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
+ok($tf->handle_http($t) == 0, 'empty If-Modified-Since');
+
+$t->{REQUEST} = ( "GET / HTTP/1.0\r\nIf-Modified-Since: foobar\r\n\r\n" );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
+ok($tf->handle_http($t) == 0, 'broken If-Modified-Since');
+
+$t->{REQUEST} = ( "GET / HTTP/1.0\r\nIf-Modified-Since: this string is too long to be a valid timestamp\r\n\r\n" );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
+ok($tf->handle_http($t) == 0, 'broken If-Modified-Since');
+
+
+$t->{REQUEST} = ( <<EOF
+GET /index.html HTTP/1.0
+If-Modified-Since2: Sun, 01 Jan 2100 00:00:03 GMT
+If-Modified-Since: Sun, 01 Jan 2100 00:00:02 GMT
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ];
+ok($tf->handle_http($t) == 0, 'Similar Headers (bug #1287)');
+
+$t->{REQUEST} = ( <<EOF
+GET /index.html HTTP/1.0
+If-Modified-Since: Sun, 01 Jan 2100 00:00:02 GMT
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304, 'Content-Type' => 'text/html' } ];
+ok($tf->handle_http($t) == 0, 'If-Modified-Since');
+
ok($tf->stop_proc == 0, "Stopping lighttpd");