I think this area is sufficiently grey.  The *only* place I've been able to
find reference to the return value of getRemoteHost() is in the JavaDoc.
The specification text is silent on this topic.  The JavaDoc makes two
statements:

1)  Returns either a fully qualified host name or an IP address.
2)  Same as the CGI REMOTE_HOST variable.

As Nick points out, these two statements are not compatible.  I'm inclined
to lean towards option 1 simply because it is the behaviour that is
explicitly spelled out in the JavaDoc, but the point could be argued in
either way.

In any case, the current implementation is no more broken then the previous
one.

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 07, 2001 4:58 PM
> To: [EMAIL PROTECTED]
> Subject: Re: About bug#208
>
>
> [EMAIL PROTECTED] (Craig R. McClanahan) writes:
> > 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).
>
> Disagree.
>
> The CGI specification (1.1) has the following to say:
>
>     * REMOTE_HOST
>       The hostname making the request. If the server does not have this
>       information, it should set REMOTE_ADDR and leave this unset.
>
> I would say the equivalent of not setting the REMOTE_HOST CGI variable
> is to have request.getRemoteHost() return null.
>
> --
>  `O O'  | [EMAIL PROTECTED]
> // ^ \\ | http://www.pyrites.org.uk/

Reply via email to