Hi Monks,
I need help thinking about why two invocations of the same code, using the same paramater values (?), seem to deliver such different results. The situation is that I have copied some working code over to another program I'm working on and I do everything I can think of to invoke it the same way. The original makes the web connection just fine, the non-working one fails with '500 EOF'. Thanks.

Specifically, my program makes a connection to Google's Gmail using Mail::Webmail::Gmail. In executing 'request' from UserAgent.pm, a section of which follows, the original version of the program makes a connection and proceeds to work fine. The copy uses the same values for the input parameters (I verified elsewhere) and ends up dying with the 500 code. From UserAgent.pm (to which I added a couple lines for debugging):

sub request { my($self, $request, $arg, $size, $previous) = @_; LWP::Debug::trace('()'); my $response = $self->simple_request($request, $arg, $size); my $wmsgB = Dumper( $response ); # I added this line to UserAgent.pm print "D-rsp:\n$wmsgB\n"; # I added this line to UserAgent.pm my $code = $response->code; $response->previous($previous) if defined $previous; print $LOGF "code: '$code'\n"; # I added this line to UserAgent.pm
The non-working invocation reports that:

D-rsp: $VAR1 = bless( { '_content' => '500 EOF ', '_rc' => 500, '_headers' => bless( { 'client-warning' => 'Internal response', 'client-date' => 'Thu, 13 Apr 2006 05:04:04 GMT', 'content-type' => 'text/plain' }, 'HTTP::Headers' ), '_msg' => 'EOF', '_request' => bless( { '_content' => 'Email=brig.johnson&Passwd=a3512j&null=S +ign+in', '_uri' => bless( do{\(my $o = 'https://www.google.com/ +accounts/ServiceLoginBoxAuth')}, 'URI::https' ), '_headers' => bless( { 'user-agent' => 'User-Agent: Mozilla/5.0 (W +indows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1. +0.4', 'content-type' => 'application/x-www-form-u +rlencoded' }, 'HTTP::Headers' ), '_method' => 'POST' }, 'HTTP::Request' ) }, 'HTTP::Response' ); code: '500'
while the working version gives:

D-rsp: $VAR1 = bless( { '_protocol' => 'HTTP/1.1', '_content' => ' <html> <head> <script type="text/javascrip +t" language="JavaScript"><!-- function doRedirect(url) { open(url, "_top"); } //--> </script> <script type="text/javascript" language="JavaScript1.4 +"><!-- function doRedirect(url) { try { open(url, "_top"); } catch (xcp) { insertContinueLink(); } } //--> </script> <script type="text/javascript" language="EcmaScript">< +!-- etc... code: '200'

In reply to Why might LWP::UserAgent be failing with '500 EOF'? by ff

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.