X-Git-Url: https://git.treefish.org/fex.git/blobdiff_plain/e5c93609849bda051fff54b5d5265af5608c6c69..20160104:/cgi-bin/fop diff --git a/cgi-bin/fop b/cgi-bin/fop index fb37261..dec3abc 100755 --- a/cgi-bin/fop +++ b/cgi-bin/fop @@ -7,6 +7,7 @@ BEGIN { ($ENV{PERLINIT}||'') =~ /(.+)/s and eval $1 } +use utf8; use Fcntl qw':flock :seek'; use Cwd qw'abs_path'; use File::Basename; @@ -552,19 +553,18 @@ if (-f $data) { and not($dkey and ($ENV{HTTP_COOKIE}||'') =~ /dkey=$dkey/) and open $file,'<',"$file/download") { - $_ = <$file> || ''; + my $d1 = <$file> || ''; # first download + chomp $d1; close $file; - chomp; if ($ra) { # allow downloads from same ip - $_ = '' if /\Q$ra/; + $d1 = '' if $d1 =~ /\Q$ra/; # allow downloads from sender ip - $_ = '' if (readlink("$file/ip")||'') eq $ra; + $d1 = '' if (readlink("$file/ip")||'') eq $ra; } - if ($_) { - s/(.+) ([\w.:]+)$/by $2 at $1/; + if ($d1 and $d1 =~ s/(.+) ([\w.:]+)$/$2 at $1/) { $file = filename($file); - http_die("$file has already been downloaded $_"); + http_die("$file has already been downloaded by $d1"); } } $sb = sendfile($file,$seek,$stop);