Re: 'POST' method leads to "411 Length Required"

Keary Suska <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.lwp
Message-ID <[email protected]>
On Apr 21, 2009, at 5:10 PM, Aaron Naiman wrote:

> Dear Björn,
>
> Thank you again for your response.
>
> * Aaron Naiman wrote:
>>>> You are using POST but are not posting any data, and apparently the
>>>> server ...
>>>>
>>>>> An Error Occurred 411 Length Required
>>>>
>>>> ... expects you to post some data when using POST.
>>>
>>> But as can be seen from .../HTTP/Status.pm, this is a *client*  
>>> error, and
>>> not a server error.
>>
>> You're sending somebody who expects a letter from you an empty  
>> envelope.
>
>
> However, from all of the examples I have seen, one need not send  
> anything in
> a POST.

Some parts of the HTTP spec are ambiguous and left to implementation.  
In this specific case, error 411 means the server is saying that you  
are not sending a necessary content-length header, which is required  
for POSt requests whether there is any content or not. It may be that  
LWP doesn't provide the header if there is no content. Did you inspect  
the request to verify that the content-length header is indeed being  
sent?

If the header is indeed being sent, the server might be choking on a 0  
length. Send bogus data to see if that helps.

HTH,

Keary Suska
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.