determining if browser is on same machine as server

2007-05-09 Thread Sam Carleton

I am working on the access to my kiosk system, one condition I need to
handle in a unique way is when a web browser is run on the same
physical machine as Apache.  It is obvious when using localhost or
127.0.0.1.  But when the URL is the machine name, I seem to be getting
an IP address.  I do see in r-server-server_hostname, is there any
way to convert that into the IP address?

Sam


Re: determining if browser is on same machine as server

2007-05-09 Thread David Wortham

Sam,
  From what I know, which is not much, a server name could be any ID given
to a computer.  It could be an IP, it could be a domain or subdomain, or
it could be any ID defined in a /etc/hosts or equivelent (which would only
have to be defined on the visitor's computer).  I believe this value is
defined to be whatever your VirtualHost is defined to be.  There could be
ServerAliases which resolve better than the actual servername.

  You can try a local getbyhostname() (which may be OS-dependent an/or
deprecated) or something similar, but there is no gurantee you will get a
good reverse-IP-lookup resolve.  Try searching the web for man
getbyhostname.  You may need to find something newer to handle IPv6
addresses (if that is a concern).

  It is true that when a visitor uses localhost to access a webserver, it
is translated into 127.0.0.1 (I believe on both sides).

  I know it's not the best and most definitive answer, but I hope it helps
a little.

Dave



On 5/9/07, Sam Carleton [EMAIL PROTECTED] wrote:


I am working on the access to my kiosk system, one condition I need to
handle in a unique way is when a web browser is run on the same
physical machine as Apache.  It is obvious when using localhost or
127.0.0.1.  But when the URL is the machine name, I seem to be getting
an IP address.  I do see in r-server-server_hostname, is there any
way to convert that into the IP address?

Sam





--
David Wortham
Senior Web Applications Developer
Unspam Technologies, Inc.
(408) 338-8863


Re: determining if browser is on same machine as server

2007-05-09 Thread David Wortham

Sam,
 I knew I missed something.  There is a C-string containing the local_ip of
the server in the conn_rec struct.

 I believe the access from a request_rec would be r-connection-local_ip

Dave





On 5/9/07, David Wortham [EMAIL PROTECTED] wrote:


Sam,
   From what I know, which is not much, a server name could be any ID
given to a computer.  It could be an IP, it could be a domain or
subdomain, or it could be any ID defined in a /etc/hosts or equivelent
(which would only have to be defined on the visitor's computer).  I believe
this value is defined to be whatever your VirtualHost is defined to be.
There could be ServerAliases which resolve better than the actual
servername.

   You can try a local getbyhostname() (which may be OS-dependent an/or
deprecated) or something similar, but there is no gurantee you will get a
good reverse-IP-lookup resolve.  Try searching the web for man
getbyhostname.  You may need to find something newer to handle IPv6
addresses (if that is a concern).

   It is true that when a visitor uses localhost to access a webserver,
it is translated into 127.0.0.1 (I believe on both sides).

   I know it's not the best and most definitive answer, but I hope it
helps a little.

Dave



On 5/9/07, Sam Carleton [EMAIL PROTECTED] wrote:

 I am working on the access to my kiosk system, one condition I need to
 handle in a unique way is when a web browser is run on the same
 physical machine as Apache.  It is obvious when using localhost or
 127.0.0.1.  But when the URL is the machine name, I seem to be getting
 an IP address.  I do see in r-server-server_hostname, is there any
 way to convert that into the IP address?

 Sam




--
David Wortham
Senior Web Applications Developer
Unspam Technologies, Inc.
(408) 338-8863





--
David Wortham
Senior Web Applications Developer
Unspam Technologies, Inc.
(408) 338-8863