[EMAIL PROTECTED] writes:

> I am still trying to achieve the following, and it seems that it may
> not be possible.
> 
> I need to generate the following request line along with the
> following header in HTTP 1.1
> 
> POST /ABCApp/TransactionInterface5_0/DServlet HTTP/1.1
> Host: test.server.com:4321
> 
> It may be that the new HTTP11 module may provide the HTTP 1.1
> functionality to include the HOST header in the request along with
> the http1.1 protocol, but I cannot figure out how to script it.
> 
> I am stuck with UserAgent because I have to send and receive a
> rather long chunk of XML, but need to use a relative URI (above) and
> a host header - neither of which are possible in UserAgent, which
> requires an absolute URL.

The interface you see at the UserAgent is not the same as the bytes on
the wire.  When you say:

   $req = HTTP::Request->new(POST => 
"http://test.server.com:4321/ABCApp/TransactionInterface5_0/DServlet";);
   $req->content("<?xml ...?> ...");

   $res = $ua->request($req);

then the http protocol layer will turn this into the following on the
wire:

   POST /ABCApp/TransactionInterface5_0/DServlet HTTP/1.0<crlf>
   Host: test.server.com:4321<crlf>
   Content-Lenght: 4444<crlf>
   <crlf>
   <?xml ...?> ...

And, if you really need HTTP/1.1 then just enable the new experimental
HTTP/1.1 module or the GHTTP module.  With libwww-perl-5.53_91 it
can be done with:

   $ua = LWP::UserAgent->new(keep_alive => 1);

Regards,
Gisle

Reply via email to