diff options
author | Jan Kneschke <jan@kneschke.de> | 2005-09-29 13:30:25 +0000 |
---|---|---|
committer | Jan Kneschke <jan@kneschke.de> | 2005-09-29 13:30:25 +0000 |
commit | 4005e69bbfe1b9a1fc774597a5ebdc58031c72a3 (patch) | |
tree | 4adf3fc8cf13ec5547ee8266832d085120aa10c3 /tests | |
parent | cebb64e47badd1fda2439f44a4110576bcd755b4 (diff) | |
download | lighttpd-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')
-rwxr-xr-x | tests/core-condition.t | 25 | ||||
-rw-r--r-- | tests/lighttpd.conf | 7 |
2 files changed, 31 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"); diff --git a/tests/lighttpd.conf b/tests/lighttpd.conf index c6e86cd6..1af1c267 100644 --- a/tests/lighttpd.conf +++ b/tests/lighttpd.conf @@ -184,3 +184,10 @@ $HTTP["host"] == "referer.example.org" { } } +$HTTP["url"] == "/empty-ref.jpg" { + $HTTP["referer"] == "" { + url.access-deny = ( "" ) + } +} + + |