summaryrefslogtreecommitdiff
path: root/tests/core-condition.t
diff options
context:
space:
mode:
authorJan Kneschke <jan@kneschke.de>2005-09-29 13:30:25 +0000
committerJan Kneschke <jan@kneschke.de>2005-09-29 13:30:25 +0000
commit4005e69bbfe1b9a1fc774597a5ebdc58031c72a3 (patch)
tree4adf3fc8cf13ec5547ee8266832d085120aa10c3 /tests/core-condition.t
parentcebb64e47badd1fda2439f44a4110576bcd755b4 (diff)
downloadlighttpd-git-4005e69bbfe1b9a1fc774597a5ebdc58031c72a3.tar.gz
added a check for $HTTP["referer"] == ""
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@753 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'tests/core-condition.t')
-rwxr-xr-xtests/core-condition.t25
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/core-condition.t b/tests/core-condition.t
index 4ca1f379..13b33df2 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 => 14;
+use Test::More tests => 17;
use LightyTest;
my $tf = LightyTest->new();
@@ -109,5 +109,28 @@ 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.jpg HTTP/1.0
+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.jpg HTTP/1.0
+Referer:
+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.jpg HTTP/1.0
+Referer: foobar
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ];
+ok($tf->handle_http($t) == 0, 'condition: $HTTP["referer"] == "" and Referer: is no set');
+
ok($tf->stop_proc == 0, "Stopping lighttpd");