This one had me up all night *yawn*

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:

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;
The only output I get from ANY web page is a 411 - Length Required error.

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:

/usr/local/squid/bin/client -h 192.168.1.1 -p 8080 http://www.google.c +om
I get the web page content as expected.

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


In reply to UserAgent and proxies by jeffa

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.