#!/sw/local/bin/perl -Tw
use strict;
use HTTP::Request;
use LWP::UserAgent;
print "Content-type: text/html\n\n";
print "\n";
my $path = $ENV{'QUERY_STRING'};
if(!$path) { dienice("Must pass in at least 1 argument.") }
my $file;
if($path =~ s:/([^/]+)$::) { $file = $1 }
else { dienice("Incorrectly formatted path : $path") }
my $ext; #file extension
if($file =~ s/\.(.+)$//) { $ext = $1 }
else { dienice("Oncorrectly formatted filename: $file") }
my $ua = LWP::UserAgent->new;
my $tmpfile;
foreach my $rev ("-", ('A'..'Z')) {
$tmpfile = "$file$rev.$ext";
my $request = HTTP::Request->new(GET => "$path/$tmpfile");
my $response = $ua->request($request);
print "$response->{_msg}
";
last if($response->{_msg} eq "OK");
}
print "
Due to security measures, you will only be able to access files in /QUALITY/DocConSys in an\
account that has access to this folder.
";
print "";
exit;
sub dienice {
print "