craigmcc 01/05/07 22:58:44
Modified: catalina/docs/config http11.html
catalina/src/conf server.xml
catalina/src/share/org/apache/catalina Connector.java
catalina/src/share/org/apache/catalina/connector/http
HttpConnector.java HttpRequestImpl.java
catalina/src/share/org/apache/catalina/connector/http10
HttpConnector.java HttpRequestImpl.java
catalina/src/share/org/apache/catalina/connector/warp
WarpConnector.java
Log:
Avoid confusing users with a double negative, by changing disableLookups
to enableLookups instead. The default in the example config file is still
to have lookups enabled, because that is what new Tomcat users expect, but
it is easy to turn this off.
Submitted by: Roy Fielding <[EMAIL PROTECTED]>
Revision Changes Path
1.5 +2 -2 jakarta-tomcat-4.0/catalina/docs/config/http11.html
Index: http11.html
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/docs/config/http11.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- http11.html 2001/05/08 03:42:21 1.4
+++ http11.html 2001/05/08 05:58:43 1.5
@@ -106,9 +106,9 @@
</tr>
<tr>
- <td><code>disableLookups</code></td>
+ <td><code>enableLookups</code></td>
<td>
- Set this attribute to <code>true</code> to disable DNS lookups of the
+ Set this attribute to <code>true</code> to enable DNS lookups of the
remote host name when <code>request.getRemoteHost()</code> is called.
If lookups are disabled, the remote IP address (as a String) is
returned instead. By default, DNS lookups are enabled.
1.24 +11 -4 jakarta-tomcat-4.0/catalina/src/conf/server.xml
Index: server.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/conf/server.xml,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- server.xml 2001/05/08 04:12:38 1.23
+++ server.xml 2001/05/08 05:58:43 1.24
@@ -40,12 +40,18 @@
* Execute: keytool -genkey -alias tomcat -keyalg RSA
with a password value of "changeit".
+ By default, DNS lookups are enabled when a web application calls
+ request.getRemoteHost(). This can have an adverse impact on
+ performance, so you can disable it by setting the
+ "enableLookups" attribute to "false". When DNS lookups are disabled,
+ request.getRemoteHost() will return the String version of the
+ IP address of the remote client.
-->
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector className="org.apache.catalina.connector.http.HttpConnector"
port="8080" minProcessors="5" maxProcessors="75"
- disableLookups="false"
+ enableLookups="true"
acceptCount="10" debug="0" connectionTimeout="60000"/>
<!-- Note : To disable connection timeouts, set connectionTimeout value
to -1 -->
@@ -54,7 +60,7 @@
<!--
<Connector className="org.apache.catalina.connector.http.HttpConnector"
port="8443" minProcessors="5" maxProcessors="75"
- disableLookups="false"
+ enableLookups="true"
acceptCount="10" debug="0" scheme="https" secure="true">
<Factory className="org.apache.catalina.net.SSLServerSocketFactory"
clientAuth="false" protocol="TLS"/>
@@ -66,6 +72,7 @@
<!--
<Connector className="org.apache.catalina.connector.http.HttpConnector"
port="8081" minProcessors="5" maxProcessors="75"
+ enableLookups="true"
acceptCount="10" debug="0" connectionTimeout="60000"
proxyPort="80"/>
-->
@@ -74,7 +81,7 @@
<!--
<Connector className="org.apache.catalina.connector.http10.HttpConnector"
port="8082" minProcessors="5" maxProcessors="75"
- disableLookups="false"
+ enableLookups="true"
acceptCount="10" debug="0"/>
-->
@@ -301,7 +308,7 @@
<Connector className="org.apache.catalina.connector.warp.WarpConnector"
port="8008" minProcessors="5" maxProcessors="75"
- disableLookups="false"
+ enableLookups="true"
acceptCount="10" debug="0"/>
<!-- Replace "localhost" with what your Apache "ServerName" is set to -->
1.4 +9 -9
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Connector.java
Index: Connector.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Connector.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Connector.java 2001/05/08 03:37:02 1.3
+++ Connector.java 2001/05/08 05:58:43 1.4
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Connector.java,v
1.3 2001/05/08 03:37:02 craigmcc Exp $
- * $Revision: 1.3 $
- * $Date: 2001/05/08 03:37:02 $
+ * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Connector.java,v
1.4 2001/05/08 05:58:43 craigmcc Exp $
+ * $Revision: 1.4 $
+ * $Date: 2001/05/08 05:58:43 $
*
* ====================================================================
*
@@ -117,7 +117,7 @@
* normative.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.3 $ $Date: 2001/05/08 03:37:02 $
+ * @version $Revision: 1.4 $ $Date: 2001/05/08 05:58:43 $
*/
public interface Connector {
@@ -143,17 +143,17 @@
/**
- * Return the "disable DNS lookups" flag.
+ * Return the "enable DNS lookups" flag.
*/
- public boolean getDisableLookups();
+ public boolean getEnableLookups();
/**
- * Set the "disable DNS lookups" flag.
+ * Set the "enable DNS lookups" flag.
*
- * @param disableLookups The new "disable DNS lookups" flag value
+ * @param enableLookups The new "enable DNS lookups" flag value
*/
- public void setDisableLookups(boolean disableLookups);
+ public void setEnableLookups(boolean enableLookups);
/**
1.14 +13 -13
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java
Index: HttpConnector.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- HttpConnector.java 2001/05/08 03:37:02 1.13
+++ HttpConnector.java 2001/05/08 05:58:44 1.14
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v
1.13 2001/05/08 03:37:02 craigmcc Exp $
- * $Revision: 1.13 $
- * $Date: 2001/05/08 03:37:02 $
+ * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v
1.14 2001/05/08 05:58:44 craigmcc Exp $
+ * $Revision: 1.14 $
+ * $Date: 2001/05/08 05:58:44 $
*
* ====================================================================
*
@@ -95,7 +95,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
- * @version $Revision: 1.13 $ $Date: 2001/05/08 03:37:02 $
+ * @version $Revision: 1.14 $ $Date: 2001/05/08 05:58:44 $
*/
@@ -150,9 +150,9 @@
/**
- * The "disable DNS lookups" flag for this Connector.
+ * The "enable DNS lookups" flag for this Connector.
*/
- private boolean disableLookups = false;
+ private boolean enableLookups = false;
/**
@@ -467,23 +467,23 @@
/**
- * Return the "disable DNS lookups" flag.
+ * Return the "enable DNS lookups" flag.
*/
- public boolean getDisableLookups() {
+ public boolean getEnableLookups() {
- return (this.disableLookups);
+ return (this.enableLookups);
}
/**
- * Set the "disable DNS lookups" flag.
+ * Set the "enable DNS lookups" flag.
*
- * @param disableLookups The new "disable DNS lookups" flag value
+ * @param enableLookups The new "enable DNS lookups" flag value
*/
- public void setDisableLookups(boolean disableLookups) {
+ public void setEnableLookups(boolean enableLookups) {
- this.disableLookups = disableLookups;
+ this.enableLookups = enableLookups;
}
1.9 +7 -7
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpRequestImpl.java
Index: HttpRequestImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpRequestImpl.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- HttpRequestImpl.java 2001/05/08 03:37:03 1.8
+++ HttpRequestImpl.java 2001/05/08 05:58:44 1.9
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpRequestImpl.java,v
1.8 2001/05/08 03:37:03 craigmcc Exp $
- * $Revision: 1.8 $
- * $Date: 2001/05/08 03:37:03 $
+ * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpRequestImpl.java,v
1.9 2001/05/08 05:58:44 craigmcc Exp $
+ * $Revision: 1.9 $
+ * $Date: 2001/05/08 05:58:44 $
*
* ====================================================================
*
@@ -81,7 +81,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
- * @version $Revision: 1.8 $ $Date: 2001/05/08 03:37:03 $
+ * @version $Revision: 1.9 $ $Date: 2001/05/08 05:58:44 $
*/
final class HttpRequestImpl
@@ -339,10 +339,10 @@
*/
public String getRemoteHost() {
- if (connector.getDisableLookups())
- return (getRemoteAddr());
- else
+ if (connector.getEnableLookups())
return (inet.getHostName());
+ else
+ return (getRemoteAddr());
}
1.5 +13 -13
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpConnector.java
Index: HttpConnector.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpConnector.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- HttpConnector.java 2001/05/08 03:37:03 1.4
+++ HttpConnector.java 2001/05/08 05:58:44 1.5
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpConnector.java,v
1.4 2001/05/08 03:37:03 craigmcc Exp $
- * $Revision: 1.4 $
- * $Date: 2001/05/08 03:37:03 $
+ * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpConnector.java,v
1.5 2001/05/08 05:58:44 craigmcc Exp $
+ * $Revision: 1.5 $
+ * $Date: 2001/05/08 05:58:44 $
*
* ====================================================================
*
@@ -94,7 +94,7 @@
* purposes. Not intended to be the final solution.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.4 $ $Date: 2001/05/08 03:37:03 $
+ * @version $Revision: 1.5 $ $Date: 2001/05/08 05:58:44 $
*/
@@ -149,9 +149,9 @@
/**
- * The "disable DNS lookups" flag for this Connector.
+ * The "enable DNS lookups" flag for this Connector.
*/
- private boolean disableLookups = false;
+ private boolean enableLookups = false;
/**
@@ -438,23 +438,23 @@
/**
- * Return the "disable DNS lookups" flag.
+ * Return the "enable DNS lookups" flag.
*/
- public boolean getDisableLookups() {
+ public boolean getEnableLookups() {
- return (this.disableLookups);
+ return (this.enableLookups);
}
/**
- * Set the "disable DNS lookups" flag.
+ * Set the "enable DNS lookups" flag.
*
- * @param disableLookups The new "disable DNS lookups" flag value
+ * @param enableLookups The new "enable DNS lookups" flag value
*/
- public void setDisableLookups(boolean disableLookups) {
+ public void setEnableLookups(boolean enableLookups) {
- this.disableLookups = disableLookups;
+ this.enableLookups = enableLookups;
}
1.3 +7 -7
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpRequestImpl.java
Index: HttpRequestImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpRequestImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HttpRequestImpl.java 2001/05/08 03:37:03 1.2
+++ HttpRequestImpl.java 2001/05/08 05:58:44 1.3
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpRequestImpl.java,v
1.2 2001/05/08 03:37:03 craigmcc Exp $
- * $Revision: 1.2 $
- * $Date: 2001/05/08 03:37:03 $
+ * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpRequestImpl.java,v
1.3 2001/05/08 05:58:44 craigmcc Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/05/08 05:58:44 $
*
* ====================================================================
*
@@ -73,7 +73,7 @@
* Implementation of <b>HttpRequest</b> specific to the HTTP connector.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.2 $ $Date: 2001/05/08 03:37:03 $
+ * @version $Revision: 1.3 $ $Date: 2001/05/08 05:58:44 $
*/
final class HttpRequestImpl
@@ -170,10 +170,10 @@
*/
public String getRemoteHost() {
- if (connector.getDisableLookups())
- return (getRemoteAddr());
- else
+ if (connector.getEnableLookups())
return (inet.getHostName());
+ else
+ return (getRemoteAddr());
}
1.10 +9 -9
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpConnector.java
Index: WarpConnector.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpConnector.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- WarpConnector.java 2001/05/08 04:12:40 1.9
+++ WarpConnector.java 2001/05/08 05:58:44 1.10
@@ -78,7 +78,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Pier Fumagalli</a>
* @author Copyright © 1999, 2000 <a href="http://www.apache.org">The
* Apache Software Foundation.
- * @version CVS $Id: WarpConnector.java,v 1.9 2001/05/08 04:12:40 craigmcc Exp $
+ * @version CVS $Id: WarpConnector.java,v 1.10 2001/05/08 05:58:44 craigmcc Exp $
*/
public class WarpConnector implements Connector, Lifecycle, Runnable {
@@ -99,8 +99,8 @@
private boolean started=false;
/** The accept count for the server socket. */
private int count = 10;
- /** Should we disable DNS lookups? */
- private boolean disableLookups = false;
+ /** Should we enable DNS lookups? */
+ private boolean enableLookups = false;
// -------------------------------------------------------- BEAN PROPERTIES
@@ -313,17 +313,17 @@
}
/**
- * Return the "disable DNS lookups" flag for this Connector.
+ * Return the "enable DNS lookups" flag for this Connector.
*/
- public boolean getDisableLookups() {
- return (this.disableLookups);
+ public boolean getEnableLookups() {
+ return (this.enableLookups);
}
/**
- * Set the "disable DNS lookups" flag for this Connector.
+ * Set the "enable DNS lookups" flag for this Connector.
*/
- public void setDisableLookups(boolean disableLookups) {
- this.disableLookups = disableLookups;
+ public void setEnableLookups(boolean enableLookups) {
+ this.enableLookups = enableLookups;
}
/**