summaryrefslogtreecommitdiff
path: root/tests/request.t
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2021-07-06 22:58:13 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2021-09-04 08:08:26 -0400
commit91472ab7681b26f36b813f3b245c0e98f91b4c3f (patch)
treec0a71cb0f9d52747ec4c0409f8863b9f64233e83 /tests/request.t
parenta0a8cf821d2292e6662119e158e73c175452f1c3 (diff)
downloadlighttpd-git-91472ab7681b26f36b813f3b245c0e98f91b4c3f.tar.gz
[tests] t/test_mod_staticfile
move some tests from tests/request.t to src/t/test_mod_staticfile.c
Diffstat (limited to 'tests/request.t')
-rwxr-xr-xtests/request.t56
1 files changed, 2 insertions, 54 deletions
diff --git a/tests/request.t b/tests/request.t
index ea8852d6..f2264486 100755
--- a/tests/request.t
+++ b/tests/request.t
@@ -8,7 +8,7 @@ BEGIN {
use strict;
use IO::Socket;
-use Test::More tests => 52;
+use Test::More tests => 44;
use LightyTest;
my $tf = LightyTest->new();
@@ -19,13 +19,6 @@ ok($tf->start_proc == 0, "Starting lighttpd") or die();
## Basic Request-Handling
$t->{REQUEST} = ( <<EOF
-GET /foobar HTTP/1.0
-EOF
- );
-$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ];
-ok($tf->handle_http($t) == 0, 'file not found');
-
-$t->{REQUEST} = ( <<EOF
GET /foobar?foobar HTTP/1.0
EOF
);
@@ -48,14 +41,6 @@ EOF
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/html' } ];
ok($tf->handle_http($t) == 0, 'GET, content == 12345, mimetype text/html');
-$t->{REQUEST} = ( <<EOF
-GET /dummyfile.bla HTTP/1.0
-Host: 123.example.org
-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
@@ -445,19 +430,6 @@ ok($tf->handle_http($t) == 0, 'OPTIONS for RTSP');
my $nextyr = (gmtime(time()))[5] + 1900 + 1;
-$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 $nextyr 00:00:03 GMT
@@ -472,15 +444,7 @@ GET /index.html HTTP/1.0
If-Modified-Since: Sun, 01 Jan $nextyr 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');
-
-$t->{REQUEST} = ( <<EOF
-GET /index.html HTTP/1.0
-If-Modified-Since: Sun, 01 Jan $nextyr 00:00:02 GMT
-EOF
- );
-$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304, '-Content-Length' => '' } ];
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304, '-Content-Length' => '', 'Content-Type' => 'text/html' } ];
ok($tf->handle_http($t) == 0, 'Status 304 has no Content-Length (#1002)');
$t->{REQUEST} = ( <<EOF
@@ -493,22 +457,6 @@ $t->{SLOWREQUEST} = 1;
ok($tf->handle_http($t) == 0, 'GET, slow \\r\\n\\r\\n (#2105)');
undef $t->{SLOWREQUEST};
-print "\nPathinfo for static files\n";
-$t->{REQUEST} = ( <<EOF
-GET /image.jpg/index.php HTTP/1.0
-EOF
- );
-$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Type' => 'image/jpeg' } ];
-ok($tf->handle_http($t) == 0, 'static file accepting pathinfo by default');
-
-$t->{REQUEST} = ( <<EOF
-GET /image.jpg/index.php HTTP/1.0
-Host: zzz.example.org
-EOF
- );
-$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ];
-ok($tf->handle_http($t) == 0, 'static file with forbidden pathinfo');
-
$t->{REQUEST} = ( <<EOF
GET /www/abc/def HTTP/1.0
EOF