#!/usr/bin/perl use strict; use warnings; use LWP (); print "Content-type: text/html\n\n<html><body>no url given\n" unless l +ength $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); }
will enable the geocities file to be hotlinked (for use off ebay etc)www.mywebserver.org/cgi-bin/file?http://www.geocities.com/myhome/me.jp +g
HOWEVER, what I see happening is that when I save the above file (which should be called me.jpg) it actually gets sent to me with the name file.jpg.
Any idea on how to make the script preserve the original filename?
In reply to Re^2: how to pipe url back to stdout as stream
by Anonymous Monk
in thread how to pipe url back to stdout as stream
by redss
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |