I'm using LWP to send XML files to customers. Since upgrading to perl 5.8.5 and LWP 5.803 I've been getting the following errors on certain sites.

500 EOF when chunk header expected

Here is what the customer is actually returning (from ethereal):

HTTP/1.1 200 OK Connection: close Date: Mon, 11 Jul 2005 21:24:55 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 1.1.4322 Transfer-Encoding: chunked Set-Cookie: ASP.NET_SessionId=2yacfaf5i2ga23bv22qmls45; path=/ Cache-Control: private Content-Type: text/xml 102 <?xml version="1.0" encoding="utf-8"?> <FloodStatus XMLRevision="1.45"> <StatusID>S1</StatusID> <StatusMessage>Cert Received</StatusMessage> <CertificateNumber>19861752</CertificateNumber> <ControlNumber>695428</ControlNumber> </FloodStatus>

I am guessing the error has to do with the transfer encoding but I don't know how to work around it.

Here is the code I use to send the XML:

# creation of the xml doc snipped # create the user agent $agent = new LWP::UserAgent or die "Unable to create HTTP Agent"; $agent->agent($AGENT); # if encoding is set -- client in this case wants no encoding if ($encode eq "T") { $response = $agent->request(POST $url,[xml=>$xml],content_type=>'a +pplication/x-www-form-urlencoded'); } else { # create a request $request = new HTTP::Request POST=>$url; $request->content_type('text/xml'); $request->content($xml); # send $response = $agent->request($request); } if ($response->is_success) { print $gl_logout "$certno: send to $url successful\n"; undef $agent; return 0; } print $gl_logout "$certno: send to $url failed\n"; print $gl_logout "$certno: Remote said: ",$response->status_line,"\n +"; undef $agent; return 1; }

In reply to Problem with Dot NET and LWP by enemyofthestate

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.