Browse Source

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
svn/tags/lighttpd-1.4.6
Jan Kneschke 16 years ago
parent
commit
4005e69bbf
  1. 25
      tests/core-condition.t
  2. 7
      tests/lighttpd.conf

25
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");

7
tests/lighttpd.conf

@ -184,3 +184,10 @@ $HTTP["host"] == "referer.example.org" {
}
}
$HTTP["url"] == "/empty-ref.jpg" {
$HTTP["referer"] == "" {
url.access-deny = ( "" )
}
}

Loading…
Cancel
Save