summaryrefslogtreecommitdiff
path: root/tests/request.t
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2018-04-21 17:23:17 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2018-08-05 03:44:15 -0400
commit1b62dc325c0c1ecba1bb993a4111310cd4c798c7 (patch)
tree1690c969d76a842998f28644a70c6fbc6f6c0938 /tests/request.t
parente8c1efd5dfc11b5001113198741536648067c024 (diff)
downloadlighttpd1.4-1b62dc325c0c1ecba1bb993a4111310cd4c798c7.tar.gz
lighttpd1.4-1b62dc325c0c1ecba1bb993a4111310cd4c798c7.zip
[tests] test_request unit tests
unit tests for request processing collect existing request processing tests from Perl tests/*.t (test_request.c runs *much* more quickly than Perl tests/*.t)
Diffstat (limited to 'tests/request.t')
-rwxr-xr-xtests/request.t88
1 files changed, 1 insertions, 87 deletions
diff --git a/tests/request.t b/tests/request.t
index fd853bf2..a9fe3f6a 100755
--- a/tests/request.t
+++ b/tests/request.t
@@ -8,7 +8,7 @@ BEGIN {
use strict;
use IO::Socket;
-use Test::More tests => 60;
+use Test::More tests => 50;
use LightyTest;
my $tf = LightyTest->new();
@@ -56,13 +56,6 @@ EOF
$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 } ];
-ok($tf->handle_http($t) == 0, 'POST request, no Content-Length');
-
$t->{REQUEST} = ( <<EOF
POST / HTTP/1.0
@@ -391,61 +384,6 @@ ok($tf->handle_http($t) == 0, 'larger headers');
$t->{REQUEST} = ( <<EOF
-GET / HTTP/1.0
-Host: www.example.org
-Host: 123.example.org
-EOF
- );
-$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
-ok($tf->handle_http($t) == 0, 'Duplicate Host headers, Bug #25');
-
-
-$t->{REQUEST} = ( <<EOF
-GET / HTTP/1.0
-Content-Length: 5
-Content-Length: 4
-EOF
- );
-$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
-ok($tf->handle_http($t) == 0, 'Duplicate Content-Length headers');
-
-$t->{REQUEST} = ( <<EOF
-GET / HTTP/1.0
-Content-Type: 5
-Content-Type: 4
-EOF
- );
-$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
-ok($tf->handle_http($t) == 0, 'Duplicate Content-Type headers');
-
-$t->{REQUEST} = ( <<EOF
-GET / HTTP/1.0
-Range: bytes=5-6
-Range: bytes=5-9
-EOF
- );
-$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
-ok($tf->handle_http($t) == 0, 'Duplicate Range headers');
-
-$t->{REQUEST} = ( <<EOF
-GET / HTTP/1.0
-If-None-Match: 5
-If-None-Match: 4
-EOF
- );
-$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
-ok($tf->handle_http($t) == 0, 'Duplicate If-None-Match headers');
-
-$t->{REQUEST} = ( <<EOF
-GET / HTTP/1.0
-If-Modified-Since: 5
-If-Modified-Since: 4
-EOF
- );
-$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
-ok($tf->handle_http($t) == 0, 'Duplicate If-Modified-Since headers');
-
-$t->{REQUEST} = ( <<EOF
GET /range.pdf HTTP/1.0
Range: bytes=0-
EOF
@@ -454,16 +392,6 @@ $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
@@ -482,16 +410,6 @@ $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
ok($tf->handle_http($t) == 0, 'OPTIONS for RTSP');
$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 /index.html HTTP/1.0
If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
@@ -500,10 +418,6 @@ EOF
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ];
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');