You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Thomas Butter <th...@i.rule-the.net> on 2001/01/03 00:36:00 UTC
binding to a specific ip doesn't work as exspected
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