>> 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.
That will be fixed ASAP. In TC 3.2.2, I'm not sure if the CVS
is still open (imminent release)
>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.
The DNS lookup must be done somewhere, and for example well-configured
Apache HTTP servers didn't do the DNS lookup. So the RemoteHostName
will not be passed in ajp12/ajp13. The job must be done by the
servlet engine. It's the case in TC 3.2 for the HTTP connector.
I'll modify the code accordingly.