On Apr 22, 2009, at 3:11 AM, Aaron Naiman wrote:

Thank you for getting back to me.

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.


Initially, I received www.google.com with GET, and "411 Length Required"
with POST.

Subsequently, I tried providing header and content:

$request = new HTTP::Request 'GET', 'http://www.google.com', [asdf =>
'fdsa'], "dummy content";

and now with GET I see: "411 Length Required", and with POST: "405 Method
Not Allowed".

So, I am pretty baffled as to what the rules are, and how I can make this
work.


I don't know about the first case, other than Google has been known to behave in nonstandard ways. a GET request shouldn't have an entity body, as I understand, and so shouldn't require a content length header.

The second case--405 method not allowed--just means the site doesn't permit a POST request. A server is not required to accept POSTs, so this response is possible.

It seems to me that the problems you are experiencing have more to do with your lack of understanding of the HTTP protocol, rather than the way LWP works. I suggest picking up a book on HTTP--I would recommend "HTTP Developers Handbook" by Chris Shiflett.

I would also underscore to not base your understanding on how google behaves. Historically Google has been unfriendly towards any interaction with their servers not performed by well known web browsing software.

Keary Suska

Reply via email to