diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2021-07-07 15:00:31 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2021-09-04 08:08:26 -0400 |
commit | f47261159720e90dc4444082b2a28bd1491634d4 (patch) | |
tree | b122b826a424df0013b77a91e6f4942400aa1f97 /tests/core-condition.t | |
parent | 91472ab7681b26f36b813f3b245c0e98f91b4c3f (diff) | |
download | lighttpd-git-f47261159720e90dc4444082b2a28bd1491634d4.tar.gz |
[tests] combine *.t using tests/lighttpd.conf
combine tests/*.t using tests/lighttpd.conf into tests/request.t
Platforms which are horrifically slow starting processes (e.g. Windows)
take much more time to start and stop lighttpd many times for
independent *.t instances run through the Perl Test::More framework
Diffstat (limited to 'tests/core-condition.t')
-rwxr-xr-x | tests/core-condition.t | 88 |
1 files changed, 1 insertions, 87 deletions
diff --git a/tests/core-condition.t b/tests/core-condition.t index 53b69c5e..40647041 100755 --- a/tests/core-condition.t +++ b/tests/core-condition.t @@ -8,7 +8,7 @@ BEGIN { use strict; use IO::Socket; -use Test::More tests => 21; +use Test::More tests => 10; use LightyTest; my $tf = LightyTest->new(); @@ -80,89 +80,3 @@ $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Serve ok($tf->handle_http($t) == 0, 'condition: handle if before else branches #2'); ok($tf->stop_proc == 0, "Stopping lighttpd"); - -$tf->{CONFIGFILE} = 'lighttpd.conf'; -ok($tf->start_proc == 0, "Starting lighttpd") or die(); - -$t->{REQUEST} = ( <<EOF -GET /nofile.png HTTP/1.0 -Host: referer.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; -ok($tf->handle_http($t) == 0, 'condition: Referer - no referer'); - -$t->{REQUEST} = ( <<EOF -GET /nofile.png HTTP/1.0 -Host: referer.example.org -Referer: http://referer.example.org/ -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; -ok($tf->handle_http($t) == 0, 'condition: Referer - referer matches regex'); - -$t->{REQUEST} = ( <<EOF -GET /image.jpg HTTP/1.0 -Host: www.example.org -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'condition: Referer - no referer'); - -$t->{REQUEST} = ( <<EOF -GET /image.jpg HTTP/1.0 -Host: www.example.org -Referer: http://referer.example.org/ -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ]; -ok($tf->handle_http($t) == 0, 'condition: Referer - referer matches regex'); - -$t->{REQUEST} = ( <<EOF -GET /image.jpg HTTP/1.0 -Host: www.example.org -Referer: http://evil-referer.example.org/ -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ]; -ok($tf->handle_http($t) == 0, 'condition: Referer - referer doesn\'t match'); - -$t->{REQUEST} = ( <<EOF -GET /nofile HTTP/1.1 -Host: bug255.example.org - -GET /nofile HTTP/1.1 -Host: bug255.example.org -Connection: close -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 403 }, { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 403 } ]; -ok($tf->handle_http($t) == 0, 'remote ip cache (#255)'); - -$t->{REQUEST} = ( <<EOF -GET /empty-ref.noref HTTP/1.0 -Cookie: empty-ref -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ]; -ok($tf->handle_http($t) == 0, 'condition: $HTTP["referer"] == "" and Referer is no set'); - -$t->{REQUEST} = ( <<EOF -GET /empty-ref.noref HTTP/1.0 -Cookie: empty-ref -Referer: -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ]; -ok($tf->handle_http($t) == 0, 'condition: $HTTP["referer"] == "" and Referer is empty'); - -$t->{REQUEST} = ( <<EOF -GET /empty-ref.noref HTTP/1.0 -Cookie: empty-ref -Referer: foobar -EOF - ); -$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ]; -ok($tf->handle_http($t) == 0, 'condition: $HTTP["referer"] == "" and Referer: foobar'); - -ok($tf->stop_proc == 0, "Stopping lighttpd"); |