Drizzt has asked for the wisdom of the Perl Monks concerning the following question:
I like to connect to a website over a proxy, using the LWP::UserAgent. So I write this little script
#!/usr/bin/perl -w use LWP::UserAgent; #Tried this notation $ENV{HTTPS_PROXY} = 'http://115.238.164.208:8080'; my $ua = LWP::UserAgent->new(); #Also tried this notation #$ua->env_proxy( ); #$ua->proxy(['https'], 'http://115.238.164.208:8080'); my $req = HTTP::Request->new(GET => 'http://google.de'); my $res = $ua->request($req); if($res->is_success) { print "Proxy works fine\n"; #print $res->decoded_content; } else { print "Proxy dont work\n"; }
The Problem I have is that I can change the Proxy IP Adress to something silly like http://blabla.com and it work too. Did I do something wrong? If not is there a way to tell the UserAgent only go over the proxy
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Issue with LWP:UserAgent use Proxy
by Corion (Patriarch) on May 06, 2014 at 11:58 UTC | |
by Drizzt (Initiate) on May 06, 2014 at 12:23 UTC | |
by Anonymous Monk on May 06, 2014 at 23:04 UTC |