On Mon, 7 May 2001, Marc Saegesser wrote:

> According to the JavaDoc for ServletRequest.getRemoteHost()
> 
> Returns the fully qualified name of the client that sent the request, or the
> IP address of the client if the name cannot be determined. For HTTP
> servlets, same as the value of the CGI variable REMOTE_HOST.
> 
> Based on that I would say that both implementations are wrong, you should
> never get an empty or a null value back.

Agreed.  You should get either a host name or an IP address (in string
form).

>  I would also argue strongly
> against having tomcat do any reverse DNS look ups.  If the web server
> doesn't tell us the remote host name just use the IP address.
> 

That works for the web-connected case.  If you're running Tomcat
stand-alone you need to be able to do the lookup.  In 4.0, that is only
done if the web app actually calls getRemoteHost(), so you don't pay the
performance hit unless you ask for it.

Craig

Reply via email to