Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: problem w/ LWP::UserAgent?

by derby (Abbot)
on May 30, 2013 at 12:35 UTC ( [id://1036038]=note: print w/replies, xml ) Need Help??


in reply to problem w/ LWP::UserAgent?

Well ... an HTTP status code of 500 normally means an Internal Server Error (but this is IIS so ... ). I would check the web server logs for more information. I doubt LWP is the problem here -- more than likely it's the CGI script (unless the CGI script uses LWP).

-derby

Replies are listed 'Best First'.
Re^2: problem w/ LWP::UserAgent?
by dorianwinterfeld (Acolyte) on May 30, 2013 at 13:43 UTC
    Thanks for your quick reply Derby. The script does use LWP::UserAgent. Here is my stripped down test script:
    use CGI qw/:standard/; use CGI::Carp (fatalsToBrowser); require LWP::UserAgent; print header; my $ua = LWP::UserAgent->new; my $url = 'http://google.com'; my $response = $ua->get($url); if ($response->is_success) { print $response->decoded_content; # or whatever } else { die "failed: $url : ", $response->status_line; }
    So, it's dying w/ Status code 500. The server logs don't say much: "GET /scripts/prince/lwp_test.plx - 200 Mozilla/5.0+(compatible;+MSIE+10.0;+Windows+NT+6.1;+WOW64;+Trident/6.0;+EIE10;ENUSWOL)" I have run this script on two different servers, after the Perl upgrade on both, and I get the same error message.

      Is it really throwing the error with the google url or was that just a change for posting? What happens if you run the above script from the command line? Do you still get the 500? The 500 error *should* be from the server the url points to and I have a hard time believing google is throwing a 500.

      The only *recent* LWP upgrade issue that I can think of is the SSL validity check on https -- but that would throw an entirely different error I believe.

      -derby
        The only *recent* LWP upgrade issue that I can think of is the SSL validity check on https
        After this (after 6.x) there were updates related to socket stuff.
      Could you run it with
      print $response->dump;
      (in case of failure) and paste output here?
Re^2: problem w/ LWP::UserAgent?
by vsespb (Chaplain) on May 30, 2013 at 15:46 UTC
    LWP can return fake HTTP 500 responses together with header Client-Warning => Internal Response. This means some internal error.

      Seems to me the most likely cause is that when upgrading his perl, he upgraded his entire webserver -- perhaps using something like XAMPP - and hasn't (re)tweaked the webserver runtime account to have network privileges.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2024-03-29 02:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found