develooper Front page | perl.libwww | Postings from April 2001

Re: How to include 'Host:' and relative URI in request header

Thread Previous
Gisle Aas
April 11, 2001 13:05
Re: How to include 'Host:' and relative URI in request header
Message ID: writes:

> I have desperately spent the last 7 days attempting to figure out how to send
> the following two lines in an HTTP request using libwww (LWP::UserAgent,
> HTTP::Request, etc.):
> POST /ABCApp/TransactionInterface5_0/DServlet HTTP/1.1
> Host:

If you do a:

   my $req = HTTP::Request->new(POST => "");

and then send it off, this should be exactly what you get on the wire.
The only difference is that you get HTTP/1.0 instead of HTTP/1.1.

LWP-5.53 contains a HTTP/1.1 protocol module so you can get that too.

> I need this to be sent to the server as the request in order to be able to
> send some XML data and receive a response.  Libwww is perfect for this -
> except for the fact that I cannot figure out how to send this header
> (although this header indicates HTTP 1.1, I only need to fool the "server"
> into believing this) I actually do not require any HTTP 1.1 functionality -
> EXCEPT for that pesky Host: header field.
> One of the stumbling blocks along the way has been the fact that I need to
> send a relative URI in the POST - and when I run my little script - I am hit
> with a "400 URL must be absolute" error.  How can I make this request send a
> relative URI (for XML's sake) and use the Host: header field to put together
> a complete URL to connect to. 

"400 URL must be absolute" sounds more like you should give it an
absolute URI instead of a relative.


Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About