'POST' method leads to "411 Length Required"

Aaron Naiman <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.lwp
Message-ID <[email protected]>
Dear libwww users,

I have spent way too many hours scratching my head on this one (ouch!).

The following code fails.

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
use HTTP::Request;
use LWP::UserAgent;
my ($ua) = new LWP::UserAgent;
$ua->proxy(["http"], "http://wwwproxy. ... :3128");

my ($request);

$request->proxy_authorization_basic("naiman", "");

my ($response);

$request = new HTTP::Request 'POST', 'http://www.google.com';

$response = $ua->request($request);

if ($response->is_success) {
    print $response->content;
} else {
    print $response->error_as_HTML;
}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Note, I am not using UserAgent's post() since I need to invoke
proxy_authorization_basic().

The response I get is:

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
An Error Occurred 411 Length Required
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

However, it works absolutely fine if I replace 'POST' with 'GET'.

I really need to POST.

Help?

adTHANXvance!!

Aaron

-- 
Aaron ("Aharon") Naiman
Jerusalem College of Technology--Machon Lev
[email protected]
http://math.jct.ac.il/~naiman
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.