hey.... i'm not sure of your favorite browser... but if it's firefox, i would suggest you load a plugin called livehttpheaders (i think). this allows you to see exactly what's happening between the browser/server so you can see what's needed from the client side when you're attempting to create a client to interface with the server....
this process will tell you whether you're using get/post etc, and what the server is expecting, sending back to the client... you can also use a cmdline app like 'curl' to quickly see if what you think is required, works.. once you get to this point, coding in perl/php/python than becomes an easy process... good luck! -----Original Message----- From: Keary Suska [mailto:hieroph...@pcisys.net] Sent: Wednesday, April 22, 2009 7:16 AM To: Aaron Naiman Cc: Libwww Perl Subject: Re: 'POST' method leads to "411 Length Required" 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