Hello again perlmonks!

Here I am with another problem that has me running out of things to throw at my computer.

For some reason I can't seem to do a GET request using LWP::UserAgent

Watching the packets I see it DOES actually send the request, but before the response comes back it starts sending RST packets and then it ends.

I've been through the entire doc on cpan for this class 10 times now and it even has the same behaviour if I copy and paste the example code from the docs as well! It also does it for any URL I try.

The is_success() method always returns true, however as the 200-Success packet never arrives I don't understand why it returns true. Also content(), decoded_content(), and even as_string() all return blank.

This is an exact copy of the code from the docs that gives me this behaviour and everything else I've tried does as well:

require LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; my $response = $ua->get('http://search.cpan.org/'); if ($response->is_success) { print $response->decoded_content; # or whatever } else { die $response->status_line; }

Could there be something wrong with my perl or libwww installation? I reinstalled both (and I'm on Gentoo which means building them from the source). I had to rebuild perl to add the iThreads functionality and then built libwww again as a last resort to try to solve this problem.

POST requests seem to go through just fine although I still don't get anything in the content() or decoded_content(), I'm not sure if that is related. The 200/Success packet does come back with the expected body data though unlike the GET requests.

I'm completely at a loss for ideas. Any help would be greatly appreciated.


In reply to LWP::UserAgent not finishing get requests? by ttlgreen

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.