> -----Original Message-----
> From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com]
> Sent: Thursday, May 27, 2010 9:12 AM
> To: Tomcat Users List
> Subject: RE: Tomcat 6.0 always uses default host in multi-host config
> 
> > From: Caldarale, Charles R
> > Subject: RE: Tomcat 6.0 always uses default host in multi-host
config
> >
> > > 1) If useIPVHosts=false (default), then the host header name
> > > determines <Host> for processing, or default host of the Engine.
> > > 2) If useIPVHosts=true, then IP address of request determines
> <Host>
> > > for processing, providing the IP is provided as the host name, or
> > > <Alias>. If not found, then default host of Engine applies.
> > > 3) Nothing external to server.xml matters to Tomcat in resolving
> > > <Host> for processing.
> > >
> > > Does that sound accurate?
> >
> > I think so, but will have to verify by looking at current code.
> 
> I was mistaken about #3: there is a lookup done to convert the IP
> address of the socket the request arrived on to a name; this is done
by
> the following code in org.apache.coyote.http11.Http11Processor (and
> equivalents for other connector types):
> 
>     if ((localName == null) && (socket != null)) {
>         InetAddress inetAddr = socket.getLocalAddress();
>         if (inetAddr != null) {
>             localName = inetAddr.getHostName();
>         }
>     }
> 
> Since the JVM caches DNS entries, I would think this will cause only
> one external DNR request for the lifetime of Tomcat.  Note that this
is
> done for the _request_, not the <Host>, and if the name is not
> resolvable, the symbolic form of the IP address is returned (so watch
> out for mixed IPv4/IPv6 networks).  The value of the <Host> name or
> <Alias> elements must match that returned by InetAddress.getHostName()
> to get a successful match.
> 
>  - Chuck

Thanks for double-checking that. From the other comments I'd seen on the
list, I figured it had to be doing something like that.  Yes, caching
the result help, but it still will do a little extra work each request.
Or is it done regardless on each request anyway?

I'm not conversant in TC internals. Where does localName normally get
set above this code?  It's beginning to sound like it's a good idea to
define both the expected DNS name and IP address for a <Host> if setting
useIPVHosts=true.  Think I'm clear now (or at least know how to set up
server.xml in the most paranoid way).

I think we're done Chuck.  Thanks again for working through this with
me.

Jeff

*******************************  NOTICE  *********************************
This message is intended for the use of the individual or entity to which 
it is addressed and may contain information that is privileged, 
confidential, and exempt from disclosure under applicable law.  If the 
reader of this message is not the intended recipient or the employee or 
agent responsible for delivering this message to the intended recipient, 
you are hereby notified that any dissemination, distribution, or copying 
of this communication is strictly prohibited.  If you have received this 
communication in error, please notify us immediately by reply or by 
telephone (call us collect at 512-343-9100) and immediately delete this 
message and all its attachments.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to