jeffa has asked for the wisdom of the Perl Monks concerning the following question:
I have a home intranet, my gateway is 192.168.1.1 and it is using the squid proxy program. I am simply trying to write a little LWP script on 192.168.1.3 that grabs a web page through the proxy. Here's the code:
The only output I get from ANY web page is a 411 - Length Required error.use strict; use LWP::UserAgent; my $ua = new LWP::UserAgent; $ua->proxy('http', 'http://192.168.1.1:8080/'); my $req = new HTTP::Request GET => 'http://www.google.com'; $req->content_type('application/x-www-form-urlencoded'); $req->content('match=www&errors=0'); my $res = $ua->request($req); $res->is_success ? print $res->content : print $res->error_as_HTML;
Sounds like my proxy is not right - however, squid offers an executable called 'client' for the purposes of testing the proxy (BTW, I am typing this on 192.168.1.3 - Netscape uses the proxy just fine). So when I issue:
I get the web page content as expected./usr/local/squid/bin/client -h 192.168.1.1 -p 8080 http://www.google.c +om
Does anybody have a idea why UserAgent doesn't like my proxy? (and if this a stricly a squid issue then I do apologize)
Thanks,
Jeff
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: UserAgent and proxies
by merlyn (Sage) on Feb 06, 2001 at 19:11 UTC | |
by jeffa (Bishop) on Feb 06, 2001 at 20:18 UTC | |
|
Re: UserAgent and proxies
by the_slycer (Chaplain) on Feb 06, 2001 at 19:16 UTC |