On Saturday 13 November 2004 13:51, Zeus Odin wrote:
> I would like to create a site that does nothing but forward requests to a
> destination site, say mydest.com. This is for nothing illicit, I am simply
> trying to circumvent a firewall's list of banned sites.
>
> :-)
>
> For instance, if I were to go to http://www.mysite.com, it would send a
> request to GET http://www.mydest.com, download to mysite.com all text and
> images to display a copy of mydest.com, then return to the client an image
> of the mydest.com page from mysite.com. Everything must appear to come from
> mysite.com.

Hi Zeus,

> I imagine I might use LWP::UserAgent for GETting, POSTing, and mirroring;
> and HTML::Parser, HTML::SimpleLinkExtor, or HTML::LinkExtor for processing
> links. I know nothing about CGI, mod_perl, or Apache but am willing to
> learn. I am probably forgetting to mention security, encryption, caching,
> and cookies. I usually use Window$ XP but also have RedHat 9 installed.

I guess LWP::UserAgent might be interesting in this context, but I wouldn't 
try to parse the responses you get. Why don't you pass the resulting code 
through only?
Something like (not tested, pseudo code only):

#!/usr/bin/perl -w

use strict;
use CGI;
use LWP::UserAgent;

# let's say your script is called like this:
# http://mysite.com/relay.pl?url=http://www.disney.com
my $query = new CGI();
my $url_to_visit = $query->param('url');

my $ua = new LWP::UserAgent();
# you should use something more general than "GET" here...don't know the
# syntax OTTOMH
my $response = $ua -> get($url_to_visit);
print $response;

> First, are there any modules that already do this? Why reinvent the box?
> ("Reinvent the wheel" is so trite.) Second, any pointers would be helpful.
> Of course, I have espoused that perl.beginners is a self-help group;
> therefore, I am not expecting any lines of code whatsoever. Just looking
> for advice, pointers, suggestions, caveats, watch-out-fors and general
> information. Should be a fun exercise!

I'm not sure, but this sounds more or less like something I read in the 
documentation of mod_proxy - maybe you want to take a look at

  http://httpd.apache.org/docs/mod/mod_proxy.html

Without having thought about it too much, there might be some security-related 
concerns you might want to think about - if you implement something like this 
accessible to the public, you allow everybody to visit web pages in a way 
that it looks like you/your server did it. What if somebody uses your "relay" 
server to download MP3s illegally? 

Just my 5 cent,

Philipp

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to