ttlgreen has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: LWP::UserAgent not finishing get requests?
by ikegami (Patriarch) on Jan 17, 2009 at 00:59 UTC | |
by ttlgreen (Sexton) on Jan 17, 2009 at 02:01 UTC | |
by ikegami (Patriarch) on Jan 17, 2009 at 02:47 UTC | |
by ttlgreen (Sexton) on Jan 17, 2009 at 03:01 UTC | |
|
Re: LWP::UserAgent not finishing get requests?
by derby (Abbot) on Jan 17, 2009 at 00:32 UTC | |
by ttlgreen (Sexton) on Jan 17, 2009 at 01:59 UTC | |
by derby (Abbot) on Jan 17, 2009 at 02:45 UTC | |
by ttlgreen (Sexton) on Jan 17, 2009 at 03:04 UTC | |
by missingthepoint (Friar) on Jan 17, 2009 at 02:49 UTC |