in reply to Re: how to pipe url back to stdout as stream
in thread how to pipe url back to stdout as stream
#!/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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: how to pipe url back to stdout as stream
by mcm (Novice) on Dec 03, 2004 at 22:02 UTC | |
|
Re^3: how to pipe url back to stdout as stream
by ikegami (Patriarch) on Dec 03, 2004 at 23:36 UTC |