#!/usr/bin/perl

# A hacked-together bit of gorp to fetch FTP urls

$| = 1;
$url = $ENV{'REQUEST_URI'};
system "lynx -source $url > /tmp/get_ftp.$$";
$ctype = "text/plain";
if ($url =~ /\.(htm|html)/i) { $ctype = "text/html"; }
if ($url =~ /\.gif/i) { $ctype = "image/gif"; }
if ($url =~ /\.(jpg|jpeg)/i) { $ctype = "image/jpg"; }
print "Content-Type: $ctype\n";
print "\n";
system "cat /tmp/get_ftp.$$";
unlink "/tmp/get_ftp.$$";
