summaryrefslogtreecommitdiff
path: root/tests/core-condition.t
diff options
context:
space:
mode:
authorJan Kneschke <jan@kneschke.de>2005-08-24 07:22:03 +0000
committerJan Kneschke <jan@kneschke.de>2005-08-24 07:22:03 +0000
commit06becfacfc846da6fb53edeef24d0ec1f7ad16c7 (patch)
treeb44bb04571f1568a1f37ceb5a63677d7fbfbce36 /tests/core-condition.t
parentf387d898702c05eac22045437c04562e00d466bb (diff)
downloadlighttpd1.4-06becfacfc846da6fb53edeef24d0ec1f7ad16c7.tar.gz
lighttpd1.4-06becfacfc846da6fb53edeef24d0ec1f7ad16c7.zip
check that the anti deeplinking via referer matches work
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@617 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'tests/core-condition.t')
-rwxr-xr-xtests/core-condition.t33
1 files changed, 32 insertions, 1 deletions
diff --git a/tests/core-condition.t b/tests/core-condition.t
index 1fc00b5c..92945413 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 => 6;
+use Test::More tests => 11;
use LightyTest;
my $tf = LightyTest->new();
@@ -51,3 +51,34 @@ ok($tf->handle_http($t) == 0, 'nesting');
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: www.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: www.example.org
+Referer: http://www.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 /nofile.png HTTP/1.0
+Host: www.example.org
+Referer: http://123.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');
+
+ok($tf->stop_proc == 0, "Stopping lighttpd");
+