RE: extract hostname from HTTP::Request

=?iso-8859-1?Q?Jonas_Nordstr=F6m?= (Jonas.Nordstrom@ei.sigma.se)
Wed, 17 Mar 1999 11:05:44 +0100


I found out that you can use the Apache object. ($s=3Dr->server, =
$serverhost =3D
$s->server_hostname).
But I have another question: How do you know if the client used http or
https? (without looking at the port number)

Jonas Nordstrom


> -----Original Message-----
> From:	Jonas Nordstr=F6m [SMTP:Jonas.Nordstrom@ei.sigma.se]
> Sent:	Wednesday, March 17, 1999 9:43 AM
> To:	libwww-perl@ics.uci.edu
> Subject:	extract hostname from HTTP::Request
>=20
> I have a modperl-script in which I want to change hostname for a =
request.
> If the original URL is for example http://myhost/test/xxx.html, then =
I
> want
> to change that to http://test/xxx.html and then use LWP::UserAgent to =
make
> a
> request to the new host. I then use HTML::Parse to print the page. As =
I
> print the page, I want to modify all links to the "test" host to
> "myhost/test". Where along the line can I extract the original =
hostname?
> Can
> I use a subroutine in HTTP::xxx or do I have to filter out the host
> myself?
>=20
> regards,
> Jonas Nordstrom