--- getfile.old Wed Nov 12 15:38:21 1997 +++ getfile Mon Nov 2 17:00:00 1998 @@ -22,7 +22,16 @@ require "config.pl"; #--------------------------------- -print "Content-type: text/html\n\n"; +$charset = ''; +$put_header = 0; + +sub http_header { + +return if ($put_header); +$put_header = 1; + +print "Content-type: text/html$charset\n\n"; +} $query = $ENV{'QUERY_STRING'}; @@ -67,11 +76,25 @@ &err_badindexdir; } -# get the url for the file from the config -open(CFG, "<$indexdir/archive.cfg") || &err_badconfig; -$input = ; -($title,$url,$subindex) = split("\t", $input); -close(CFG); +$explicit_only = 0; +$remote_limit = 0; +$local_limit = 0; +$addboxes = 0; +$numhops = 0; +$nhhops = 0; +$traverse_type = 0; +$url = ''; +$vhost = ''; +$usemaxmem = ''; +$locale = ''; +@urllist = (); + +($title, $url, $traverse_type, $explicit_only, $numhops, + $nhhops, $local_limit, $remote_limit, $addboxes, $vhost, $usemaxmem, $locale, $charset, @urllist) = ReadConfig($indexdir); + +$charset = "; charset=$charset" if ($charset ne ''); + +&http_header; # print "indexdir = $indexdir
file = $file
line = $line
query=$query
\n"; @@ -149,12 +172,12 @@ if ($HTML) { $baseurl && s##<BASE HREF=\"$baseurl\">$&#i; - s|\<([\w\$][-\w.\$]*\@\w[-\w.]+)>|\<a href="/cgi-bin/artbyid?$1"\>\<$1\>\</a\>|g; +# s|\<([\w\$][-\w.\$]*\@\w[-\w.]+)>|\<a href="/cgi-bin/artbyid?$1"\>\<$1\>\</a\>|g; } else { s|\&|\&|g; s|\<|\<|g; s|\>|\>|g; - s|\<([\w\$][-\w.\$]*\@\w[-\w.]+)>|\<a href="/cgi-bin/artbyid?$1"\>\<$1\>\</a\>|g; +# s|\<([\w\$][-\w.\$]*\@\w[-\w.]+)>|\<a href="/cgi-bin/artbyid?$1"\>\<$1\>\</a\>|g; # s|\bgopher://([^ ><'")(]*[\w\/])\b|\<a href="$&">$&\</a>|g; # s|\bhttp://[-.\w?/+&\%:]+[.\w/]\b|\<a href="$&">$&\</a>|g; # s|\bftp://[-.\w/+]+[.\w/]\b|\<a href="$&"\>$&\</a\>|g; @@ -177,24 +200,28 @@ close(INPUT); sub err_badconfig { + &http_header; print "<TITLE>Error\n"; print "

Error with \"$indexdir\"

\n"; print "Cannot open configuration file for archive directory.\n"; exit; } sub err_noindexdir { + &http_header; print "Error\n"; print "

Error with \"$indexdir\"

\n"; print "Archive directory does not exist.\n"; exit; } sub err_badindexdir { + &http_header; print "Error\n"; print "

Error with \"$indexdir\"

\n"; print "Directory is not an archive directory.\n"; exit; } sub err_noaccess { + &http_header; print "Access denied\n"; print "

Access to \"$path\" denied

\n"; print "You don't have permission to get file \"$path\"\n"; @@ -203,6 +230,7 @@ } sub err_file { local ($path) = @_; + &http_header; print "Cannot read file \"$path\"\n"; print "

Cannot read file \"$path\": $!

\n"; exit;