in reply to Forcing Content-Length Value in LWP

How are you doing the post? If you use HTTP::Request::Common, then it will construct the content and calculate the Content-Length. It can even do dynamic file uploads where the file isn't read into memory. For other requests, LWP will calculate the Content-Length header if the content is a string.

The error you are getting implies that you (or LWP) is setting the Content-Length but there is no content being posted.

  • Comment on Re: Forcing Content-Length Value in LWP

Replies are listed 'Best First'.
Re: Re: Forcing Content-Length Value in LWP
by Anonymous Monk on Mar 25, 2004 at 22:57 UTC
    Thanks for your help, both people.

    I found that by using a very well-publicised short sub, and deleting my own efforts, I was able to build the query-string and utilise LWP to make the post. I think the problem is that I'm still very 'green' when it comes to perl. The way I got around it was to use, virtually unchanged, a sub called do_POST (from perldoc.org), passing it a URL and references to the constructed hash and header objects.

    Again, many thanks for your help.