summaryrefslogtreecommitdiff
path: root/tests/request.t
diff options
context:
space:
mode:
authorJan Kneschke <jan@kneschke.de>2006-01-03 13:59:46 +0000
committerJan Kneschke <jan@kneschke.de>2006-01-03 13:59:46 +0000
commit580823f791a8182b674ef5abd9699aa15252725b (patch)
treed79edb2b1eda4ac1ac59951e4448b7d16c011637 /tests/request.t
parentf3e3fc800742fdb5f1be222956f14ce1f7f7c02b (diff)
downloadlighttpd-git-580823f791a8182b674ef5abd9699aa15252725b.tar.gz
forbid Content-Length for GET, HEAD or OPTIONS requests
allow duplicate If-Modified-Since headers if they are equal git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@907 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'tests/request.t')
-rwxr-xr-xtests/request.t40
1 files changed, 39 insertions, 1 deletions
diff --git a/tests/request.t b/tests/request.t
index 40490131..be1f5d8f 100755
--- a/tests/request.t
+++ b/tests/request.t
@@ -8,7 +8,7 @@ BEGIN {
use strict;
use IO::Socket;
-use Test::More tests => 29;
+use Test::More tests => 33;
use LightyTest;
my $tf = LightyTest->new();
@@ -300,7 +300,45 @@ EOF
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
ok($tf->handle_http($t) == 0, 'GET, Range with range-requests-disabled');
+$t->{REQUEST} = ( <<EOF
+GET / HTTP/1.0
+Content-Length: 4
+
+1234
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
+ok($tf->handle_http($t) == 0, 'GET with Content-Length');
+
+$t->{REQUEST} = ( <<EOF
+OPTIONS / HTTP/1.0
+Content-Length: 4
+
+1234
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
+ok($tf->handle_http($t) == 0, 'OPTIONS with Content-Length');
+$t->{REQUEST} = ( <<EOF
+HEAD / HTTP/1.0
+Content-Length: 4
+
+1234
+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
+If-Modified-Since: Sun, 1970 Jan 01 00:00:01 GMT
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
+ok($tf->handle_http($t) == 0, 'Duplicate If-Mod-Since, with equal timestamps');
ok($tf->stop_proc == 0, "Stopping lighttpd");