Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Any ideas why a script would return a 500 error when called by LWP::Simple get but not when called by Chrome?

Be aware that LWP::UserAgent creates and emits its own 500 errors on certain occasions, see Re^2: HTTP error response code 500 using LWP::UserAgent on one site, but not on any other by afoken. So, what you are seeing may be coming from LWP's handling of the transaction and not the server (running your cgi-script). Two differences between Chrome and your LWP test script can be the response/connection timeout and the user-agent string, in addition to certificate-related problems which you seem to have excluded.

The intermittent behaviour you mentioned from the 2nd script can again be cause by short timeouts, e.g. when the script fetches the cached file it takes very short time and is within the timeout. But when the cache expires, it will take significantly longer and can fail the timeout. But even if that script does not use a cache, try setting a long timeout in both scripts (the cgi and the test) and see.

When I use LWP for purposes other than playing around, I want to keep as much control as possible: I always use LWP::UserAgent.

Finally, there's also LWP::Curl with same API which you can use as an alternative, though LWP::UserAgent never failed me. (I also prefer to use a host with unix CLI so as to avoid hair pulling, but I said that before already...)

bw, bliako


In reply to Re: CGI::Carp fatalsToFile by bliako
in thread CGI::Carp fatalsToFile by Bod

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-04-23 12:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found