--- loncom/lonnet/perl/lonnet.pm 2001/08/09 19:28:47 1.147 +++ loncom/lonnet/perl/lonnet.pm 2001/08/12 01:18:37 1.148 @@ -122,7 +122,7 @@ # 5/30 H. K. Ng # 6/1 Gerd Kortemeyer # July Guy Albertelli -# 8/4,8/7,8/8,8/9 Gerd Kortemeyer +# 8/4,8/7,8/8,8/9,8/11 Gerd Kortemeyer package Apache::lonnet; @@ -1108,10 +1108,22 @@ sub allowed { } } - if (($ENV{'HTTP_REFERER'}) && ($checkreferer)) { - my $refuri=$ENV{'HTTP_REFERER'}; - $refuri=~s/^http\:\/\/$ENV{'request.host'}//i; - $refuri=&declutter($refuri); + if ($checkreferer) { + my $refuri=$ENV{'httpref.'.$uri}; + + unless ($refuri) { + map { + if ($_=~/^httpref\..*\*/) { + my $pattern=$_; + $pattern=~s/\*/\[\^\/\]\+/g; + $pattern=~s/\//\\\//g; + if ($uri=~/$pattern/) { + $refuri=$ENV{$_}; + } + } + } keys %ENV; + } + if ($refuri) { my @uriparts=split(/\//,$refuri); my $filename=$uriparts[$#uriparts]; my $pathname=$refuri; @@ -1129,6 +1141,7 @@ sub allowed { } } } + } } }