LWP connect failing - bad hostname
am 07.06.2006 18:28:15 von Clifford Snow
I have two different scripts that use the LWP module that stopped
working yesterday, June 6. I ran the following script to verify that
the problem was the LWP module:
#!/usr/bin/perl
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
$req = HTTP::Request->new(GET => 'http://www.linpro.no/lwp');
$res = $ua->request($req);
# check the outcome
if ($res->is_success) {
print $res->content;
} else {
print "Error: " . $res->status_line . "\n";
}
The error message returned is
"Error: 500 Can't connect to www.linpro.no:80
(Bad hostname 'www.linpro.no')"
I verified that I can connect to the site using firefox and ping
so I believe that dns is working properly.
I'm running perl v5.8.5 and libwww-perl-5.805.
The only thing that changed on my system was the updating of mozilla,
firefox, xorg and squiremail.
Thanks,
Clifford
Re: LWP connect failing - bad hostname -FIXED
am 07.06.2006 23:50:40 von Clifford Snow
On Wed, 07 Jun 2006 09:28:15 -0700, Clifford Snow wrote:
> I have two different scripts that use the LWP module that stopped
> working yesterday, June 6. I ran the following script to verify that
> the problem was the LWP module:
>
> #!/usr/bin/perl
> use LWP::UserAgent;
> $ua = LWP::UserAgent->new;
>
> $req = HTTP::Request->new(GET => 'http://www.linpro.no/lwp');
>
> $res = $ua->request($req);
>
> # check the outcome
> if ($res->is_success) {
> print $res->content;
> } else {
> print "Error: " . $res->status_line . "\n";
> }
>
> The error message returned is
> "Error: 500 Can't connect to www.linpro.no:80
> (Bad hostname 'www.linpro.no')"
>
> I verified that I can connect to the site using firefox and ping
> so I believe that dns is working properly.
>
> I'm running perl v5.8.5 and libwww-perl-5.805.
>
> The only thing that changed on my system was the updating of mozilla,
> firefox, xorg and squiremail.
>
Found the problem - it was a corrupted /etc/hosts file that I had modified
yesterday. Strange how it screwed up LWP but everything else worked fine.
I'm posting this just in case someone else has similar problems.
Clifford