You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Adam Ness <no...@hotmail.com> on 2002/06/13 23:49:32 UTC
Apache::URI::hostname is blank
For some odd reason, Apache::URI::hostname is showing up as blank. I've
tried reading the various man pages and the Oriley book, but I can't find
any explanation for why hostname would be blank.. Am I overlooking
something?
Thanks in advance.
--
"Write the bad things that are done to you in sand, but write the good
things that happen to you on a piece of marble."--Arabic proverb
Adam Ness
AIM: GreyLurk | YIM: greylurk1
LiveJournal: incarnate | Journalscape: incarnate
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
Re: Apache::URI::hostname is blank
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Adam Ness wrote:
> For some odd reason, Apache::URI::hostname is showing up as blank. I've
> tried reading the various man pages and the Oriley book, but I can't
> find any explanation for why hostname would be blank.. Am I overlooking
> something?
yes :) see Recipe 5.3 in the cookbook for the complete lowdown, but I'm
pretty sure it's there in the eagle as well...
for the moment, though, know that there are two ways of getting an
Apache::URI object:
my $uri = $r->parsed_uri;
my $uri = Apache::URI->parse($r);
parsed_uri() will only return the scheme, port, and hostname if the
incoming URI is an absolute URI (which is typically the case with
proxies but atypical for most of your programing).
Apache::URI->parse($r) tries to find what it can from the request, then
it makes decisions based on what else Apache knows about the server.
typically this will involve populating $uri->hostname but, as someone
brought up just recently, if you use a _default_ vhost config you'll get
'_default_' for the hostname.
there are other differences between the two methods, but this is what
you're interested in now...
--Geoff