LWP and HTTP/1.1

domm on 2006-04-06T08:35:43

So, to conform to some anal webservice I had to issue a HTTP-request with 'HTTP/1.1' in the 'headers' (actually in the first line posted to the server, like 'POST /foo/bar HTTP/1.1').

First I wondered that HTTP::Request isn't issuing it by default (or at least 'HTTP/1.0'). But the requests only started with 'POST /foo/bar'. After some futile paging through LWP docs, I greped the source code, and after some fiddling discovered the protocol method in HTTP::Message.

Now, HTTP::Request ISA HTTP::Message, and states so in the docs: "HTTP::Request is a subclass of HTTP::Message and therefore inherits its methods.". I still missed this point, which caused a 30-minutes detour. And I can only blame me, Grr

But now I know, and for future (google) reference:

my $req=HTTP::Request->new(...);
$req->protocol('HTTP/1.1');