tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Butter <tho...@i.rule-the.net>
Subject binding to a specific ip doesn't work as exspected
Date Tue, 02 Jan 2001 23:36:00 GMT
Binding tomcat to a IP that is not an IP of the hostname fails, because 
it is checked in org.apache.catalina.connector.HttpConnector.open().

I don't think that this makes any sense. In a virtual host enviroment 
the hostname doesn't need to have A RRs for all IPs.

A simple fix would be to exchange the open() function with this code:

   /**
    * Open and return the server socket for this Connector.  If an IP
    * address has been specified, the socket will be opened only on that
    * address; otherwise it will be opened on all addresses.
    *
    * @exception IOException if an input/output error occurs
    */ 
   private ServerSocket open() throws IOException {
      
       // Acquire the server socket factory for this Connector
       ServerSocketFactory factory = getFactory();

       // If no address is specified, open a connection on all addresses
       if (address == null) {
           log(sm.getString("httpConnector.allAddresses")); 
           return (factory.createSocket(port, acceptCount));
       }

       // Open InetAddress a server socket on the specified address
       // Simply get the InetAddress for the address
is=InetAddress.getByName(address);
log(sm.getString("httpConnector.anAddress", address));
return (factory.createSocket(port, acceptCount,is));
}


The error check you used before should not be necessary because the 
ServerSocket constructor should throw a IOException if you use a 
non-local-interface.


Thomas Butter


Mime
View raw message