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

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

Thread Next
From:
MrLarf9
Date:
April 11, 2001 11:48
Subject:
How to include 'Host:' and relative URI in request header
Message ID:
cd.4e6bccd.2805f014@aol.com
Hello to all.

I am wondering if anyone has dealt with the following issue, or can offer a
suggestion or script snippet to prevent me from going insane.

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: test.server.com:4321

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. 

I learned that LWPng can probably take care of my problems, but I am not sure
(I am stuck with NT servers w/ Active State 5.6 on my end).  I am also very
weary of compiling or makefile-ing anything related to perl - I am spoiled by
active state, and was not able to find sufficient info on successful LWPng NT
implementations or the installation process.

Basically - does anyone know if the situation above can be taken care of with
UserAgent or HTTP::Request, and if so - could you please give me a clue as to
how?

Thank you all for your time.

Regards
Klaus Wright

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About