Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: GD and LWP giving 500 errors

by huck (Parson)
on Mar 16, 2017 at 20:39 UTC ( #1184928=note: print w/replies, xml ) Need Help??


in reply to GD and LWP giving 500 errors

im not sure why GD is involved, but for the calls using LWP::UserAgent i have a few suggestions. Lets assume you code looks like

my $ua = new LWP::UserAgent(); my $req = new HTTP::Request (GET => $uri); my $request = $ua->request ($req);
have you inspected $request->content and $request->status_line for further info like
500 Can't connect to no.such.server.in.my.lan:80 (Bad hostname)
That may help you identify what is going on.

ssl problems can also case a 500. if you change the line to

my $ua=LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 });
and it starts working it means you probably have outdated certificates. rather than to continue to skip ssl verification there are modules to update. Mozilla::CA IO::Socket::SSL Net::SSLeay come to mind.

if those dont seem to identify the problem add this

Use Data::Dumper; print Dumper ($request);
That will dump the entire request hash, and inspecting it may provide further insight

one more thought. There may be some sort of blocking base on the agent. If you change the line to

my $ua = new LWP::UserAgent(agent =>"myagent");
and it starts working someone is filtering lwp. another agent you could try is something like
my $ua = new LWP::UserAgent(agent =>"Mozilla/5.0 (Windows NT 5.1; rv +:51.0) Gecko/20100101 Firefox/51.0");

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1184928]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2019-09-23 14:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The room is dark, and your next move is ...












    Results (279 votes). Check out past polls.

    Notices?