Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Trouble with LWP, post request and XML data

by tobyink (Abbot)
on Jul 11, 2013 at 08:04 UTC ( #1043645=note: print w/ replies, xml ) Need Help??


in reply to Trouble with LWP, post request and XML data

The nameless monk is correct in that the Net-HTTP changelog does list several changes with regard to chunked encoding in 6.04, so upgrading to the latest version (currently 6.06) might help you out.

Your problem may stem from the fact that the HTTP response you gave included this header:

Transfer-Encoding: chunked

However, the body of the response is not formatted as a chunked encoding. In chunked encodings, the first line (and various subsequent lines, but I won't go into the details) is expected to be an integer, giving the size of a chunk in bytes. However, the first line of the response body is:

<?xml version="1.0" encoding="UTF-8"?>

Hence the message, "Bad chunk-size in HTTP response".

So the HTTP response is broken. If you have the option of fixing it at that end, that's what you should do. If you can't fix it at that end, then there are a couple of options: patch LWP to cope with the broken HTTP response (and you might get this accepted upstream if you can show it's a common problem, and your patch doesn't harm non-broken HTTP responses); or set up a proxy that fixes broken chunked encoding and make all your requests via the proxy.

package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name


Comment on Re: Trouble with LWP, post request and XML data
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (11)
As of 2014-11-27 08:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (182 votes), past polls