Check SERVER_PORT when validating referers

Bug #284372 r=timeless
This commit is contained in:
cls%seawood.org 2006-05-16 05:23:22 +00:00
Родитель c7f0eac9f4
Коммит d48d002a2f
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -1063,12 +1063,12 @@ sub validateReferer {
my (@scripts) = @_;
my $script;
my $found = 0;
my $script_path = dirname("$ENV{'SERVER_NAME'}$ENV{'SCRIPT_NAME'}");
my $script_path = dirname($ENV{'SCRIPT_NAME'});
my $referer = $ENV{'HTTP_REFERER'} || "";
foreach $script (@scripts) {
$found++ if
($referer =~ m@^http(s)?://(\w+(:\w+)?\@)?$script_path/$script(\?|$)@i);
($referer =~ m@^http(s)?://(\w+(:\w+)?\@)?$ENV{'SERVER_NAME'}(:$ENV{'SERVER_PORT'})?$script_path/$script(\?|$)@i);
}
die "This script cannot be called directly.\n" if (!$found);
}