#!/usr/bin/perl use strict; use warnings; use LWP (); print "Content-type: text/html\n\nno url given\n" unless length $ENV{QUERY_STRING}; my $ua = LWP::UserAgent->new(); my $request = HTTP::Request->new('GET', $ENV{QUERY_STRING} ); my $response = $ua->request($request, \&callback); sub callback { my ($data, $response, $protocol) = @_; unless ($response->{'callback_first'}) { $response->{'callback_first'} = 1; my $content_type = join('; ', $response->content_type()); print("Content-Type: $content_type\n"); print("\n"); } print($data); } #### www.mywebserver.org/cgi-bin/file?http://www.geocities.com/myhome/me.jpg