logo       

is_success() returning tru even though server was down: msg#00000

lang.perl.modules.lwp

Subject: is_success() returning tru even though server was down

I have some code that does:

my $req = HTTP::Request->new(GET => "http://$foo/bar";);
my $res = $ua->request($req);
push @good, $foo if ($res->is_success);

in a loop.

I tested that is_success did the right thing if the file bar was not
in teh server's $SERVER_ROOT, and I presumed it would return false
if $foo was not up.

But in fact, $res->_rc is 200 when the remote box is down just like
when the file bar exists.

Tested on gentoo w/ latest ebuilds of perl and libwww, and freebsd
5.2.1 w/ their ports.

Why does _rc == 200 when their was no reply from the server?

I presume part of the problem is that it appears to be sending a HTTP
0.9 GET rather than a 1.0 GET. I don't see anything in the docs
about forcing the latter. How is that done?

Or should I do a HEAD instead of a GET, given that I'm only testing
for the existence of the file and the network connection between the
two boxen?

-JimC
--
James H. Cloos, Jr. <cloos@xxxxxxxxxxx>



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise