cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10 HttpConnector.java
craigmcc01/09/11 10:33:02 Modified:catalina/src/share/org/apache/catalina/connector/http HttpConnector.java catalina/src/share/org/apache/catalina/connector/http10 HttpConnector.java Log: Tweak the log messages printed during connector startup to avoid printing "null" because the thread name has not been initialized yet (which can incorrectly imply that something is wrong). PR: Bugzilla #3547 Submitted by: Martijn Koster <[EMAIL PROTECTED]> Revision ChangesPath 1.24 +14 -8 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.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- HttpConnector.java2001/08/29 01:44:07 1.23 +++ HttpConnector.java2001/09/11 17:33:02 1.24 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v 1.23 2001/08/29 01:44:07 remm Exp $ - * $Revision: 1.23 $ - * $Date: 2001/08/29 01:44:07 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v 1.24 2001/09/11 17:33:02 craigmcc Exp $ + * $Revision: 1.24 $ + * $Date: 2001/09/11 17:33:02 $ * * * @@ -96,7 +96,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.23 $ $Date: 2001/08/29 01:44:07 $ + * @version $Revision: 1.24 $ $Date: 2001/09/11 17:33:02 $ */ @@ -872,10 +872,13 @@ private void log(String message) { Logger logger = container.getLogger(); +String localName = threadName; +if (localName == null) +localName = "HttpConnector"; if (logger != null) -logger.log(threadName + " " + message); +logger.log(localName + " " + message); else -System.out.println(threadName + " " + message); +System.out.println(localName + " " + message); } @@ -889,10 +892,13 @@ private void log(String message, Throwable throwable) { Logger logger = container.getLogger(); +String localName = threadName; +if (localName == null) +localName = "HttpConnector"; if (logger != null) -logger.log(threadName + " " + message, throwable); +logger.log(localName + " " + message, throwable); else { -System.out.println(threadName + " " + message); +System.out.println(localName + " " + message); throwable.printStackTrace(System.out); } 1.12 +14 -8 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.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- HttpConnector.java2001/08/23 22:32:10 1.11 +++ HttpConnector.java2001/09/11 17:33:02 1.12 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpConnector.java,v 1.11 2001/08/23 22:32:10 craigmcc Exp $ - * $Revision: 1.11 $ - * $Date: 2001/08/23 22:32:10 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpConnector.java,v 1.12 2001/09/11 17:33:02 craigmcc Exp $ + * $Revision: 1.12 $ + * $Date: 2001/09/11 17:33:02 $ * * * @@ -95,7 +95,7 @@ * purposes. Not intended to be the final solution. * * @author Craig R. McClanahan - * @version $Revision: 1.11 $ $Date: 2001/08/23 22:32:10 $ + * @version $Revision: 1.12 $ $Date: 2001/09/11 17:33:02 $ */ @@ -799,10 +799,13 @@ private void log(String message) { Logger logger = container.getLogger(); +String localName = threadName; +if (localName == null) +localName = "HttpConnector"; if (logger != null) -logger.log(threadName + " " + message); +logger.log(localName + " " + message); else -System.out.println(threadName + " " + message); +System.out.println(localName + " " + message); } @@ -816,10 +819,13 @@ private void log(String
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10 HttpConnector.java
pier01/07/22 15:36:09 Modified:catalina/src/share/org/apache/catalina/connector/http HttpConnector.java catalina/src/share/org/apache/catalina/connector/http10 HttpConnector.java Log: Moved socket creation in the initialize() method, to allow port <= 1024 binding when running as non-root and using JSVC. Revision ChangesPath 1.21 +12 -12 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.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- HttpConnector.java2001/07/22 20:25:07 1.20 +++ HttpConnector.java2001/07/22 22:36:09 1.21 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v 1.20 2001/07/22 20:25:07 pier Exp $ - * $Revision: 1.20 $ - * $Date: 2001/07/22 20:25:07 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v 1.21 2001/07/22 22:36:09 pier Exp $ + * $Revision: 1.21 $ + * $Date: 2001/07/22 22:36:09 $ * * * @@ -95,7 +95,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.20 $ $Date: 2001/07/22 20:25:07 $ + * @version $Revision: 1.21 $ $Date: 2001/07/22 22:36:09 $ */ @@ -1073,7 +1073,14 @@ throw new LifecycleException ( sm.getString("httpConnector.alreadyInitialized")); this.initialized=true; -System.err.println("HTTP Connector initialized"); + +// Establish a server socket on the specified port +try { +serverSocket = open(); +} catch (IOException e) { +throw new LifecycleException(threadName + ".open", e); +} + } @@ -1091,13 +1098,6 @@ threadName = "HttpConnector[" + port + "]"; lifecycle.fireLifecycleEvent(START_EVENT, null); started = true; - -// Establish a server socket on the specified port -try { -serverSocket = open(); -} catch (IOException e) { -throw new LifecycleException(threadName + ".open", e); -} // Start our background thread threadStart(); 1.10 +12 -11 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.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- HttpConnector.java2001/07/22 20:25:07 1.9 +++ HttpConnector.java2001/07/22 22:36:09 1.10 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpConnector.java,v 1.9 2001/07/22 20:25:07 pier Exp $ - * $Revision: 1.9 $ - * $Date: 2001/07/22 20:25:07 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpConnector.java,v 1.10 2001/07/22 22:36:09 pier Exp $ + * $Revision: 1.10 $ + * $Date: 2001/07/22 22:36:09 $ * * * @@ -94,7 +94,7 @@ * purposes. Not intended to be the final solution. * * @author Craig R. McClanahan - * @version $Revision: 1.9 $ $Date: 2001/07/22 20:25:07 $ + * @version $Revision: 1.10 $ $Date: 2001/07/22 22:36:09 $ */ @@ -977,6 +977,14 @@ throw new LifecycleException ( sm.getString("httpConnector.alreadyInitialized")); this.initialized=true; + +// Establish a server socket on the specified port +try { +serverSocket = open(); +} catch (IOException e) { +throw new LifecycleException(threadName + ".open", e); +} + } /** @@ -993,13 +1001,6 @@ threadName = "HttpConnector[" + port + "]"; lifecycle.fireLifecycleEvent(START_EVENT, null); started = true; - -// Establish a server socket on the specified port -try { -serverSocket = open(); -} catch (IOException e) { -throw new LifecycleException(threadName + ".open", e); -} // Start our background thread threadStart();
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10 HttpConnector.java
remm01/07/10 00:37:08 Modified:catalina/src/share/org/apache/catalina/connector/http10 HttpConnector.java Log: - Negative value for maxProcessors means unlimited number of processors. Bug reported by Kumar Mettu Revision ChangesPath 1.7 +12 -7 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.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- HttpConnector.java2001/05/09 23:42:14 1.6 +++ HttpConnector.java2001/07/10 07:37:05 1.7 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpConnector.java,v 1.6 2001/05/09 23:42:14 craigmcc Exp $ - * $Revision: 1.6 $ - * $Date: 2001/05/09 23:42:14 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpConnector.java,v 1.7 2001/07/10 07:37:05 remm Exp $ + * $Revision: 1.7 $ + * $Date: 2001/07/10 07:37:05 $ * * * @@ -94,7 +94,7 @@ * purposes. Not intended to be the final solution. * * @author Craig R. McClanahan - * @version $Revision: 1.6 $ $Date: 2001/05/09 23:42:14 $ + * @version $Revision: 1.7 $ $Date: 2001/07/10 07:37:05 $ */ @@ -742,10 +742,15 @@ synchronized (processors) { if (processors.size() > 0) return ((HttpProcessor) processors.pop()); - if ((maxProcessors > 0) && (curProcessors < maxProcessors)) + if ((maxProcessors > 0) && (curProcessors < maxProcessors)) { return (newProcessor()); - else - return (null); + } else { +if (maxProcessors < 0) { +return (newProcessor()); +} else { +return (null); +} +} } }
Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10 HttpConnector.java HttpRequestImpl.java
On Tue, 8 May 2001, Kief Morris wrote: > [EMAIL PROTECTED] typed the following on 03:37 AM 5/8/2001 + > > Make it possible to disable DNS lookups of the remote host name, for > > Tomcat used stand-alone, even when the web app calls > > request.getRemoteHost(). Lookups are enabled by default -- disable them > > by modifying the attribute. > > I think it would be better to have DNS lookups _disabled_ by default (doesn't > Apache httpd do this?). If someone really needs to get the hostname for > their app, they can take the trouble to enable it, but the "out of the box > experience" for Tomcat shouldn't be pig-slow for a probably unnecessary > feature. IMHO of course. ;-) > I can see your point (having been brow-beaten in a discussion on this topic late last night :-). However, the counter-arguments are: * Changing it to disabled by default would change behavior versus current Tomcats (of all generations), and possibly break apps that depend on host lookups. * Newbie servlet developers expect the API calls to work the way that the name implies - disabled by default would lead to lots of questions. I added a note in the default server.xml file with regards to potential performance impacts. > Kief > > Craig
Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10 HttpConnector.java HttpRequestImpl.java
[EMAIL PROTECTED] typed the following on 03:37 AM 5/8/2001 + > Make it possible to disable DNS lookups of the remote host name, for > Tomcat used stand-alone, even when the web app calls > request.getRemoteHost(). Lookups are enabled by default -- disable them > by modifying the attribute. I think it would be better to have DNS lookups _disabled_ by default (doesn't Apache httpd do this?). If someone really needs to get the hostname for their app, they can take the trouble to enable it, but the "out of the box experience" for Tomcat shouldn't be pig-slow for a probably unnecessary feature. IMHO of course. ;-) Kief
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10 HttpConnector.java HttpRequestImpl.java
craigmcc01/05/07 20:37:04 Modified: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 Log: Make it possible to disable DNS lookups of the remote host name, for Tomcat used stand-alone, even when the web app calls request.getRemoteHost(). Lookups are enabled by default -- disable them by modifying the attribute. Submitted by: Roy T. Fielding <[EMAIL PROTECTED]> Revision ChangesPath 1.22 +3 -0 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.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- server.xml2001/04/27 00:34:00 1.21 +++ server.xml2001/05/08 03:37:01 1.22 @@ -45,6 +45,7 @@ @@ -53,6 +54,7 @@ 1.3 +18 -4 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.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Connector.java2000/09/08 22:29:34 1.2 +++ Connector.java2001/05/08 03:37:02 1.3 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Connector.java,v 1.2 2000/09/08 22:29:34 craigmcc Exp $ - * $Revision: 1.2 $ - * $Date: 2000/09/08 22:29:34 $ + * $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 $ * * * @@ -117,7 +117,7 @@ * normative. * * @author Craig R. McClanahan - * @version $Revision: 1.2 $ $Date: 2000/09/08 22:29:34 $ + * @version $Revision: 1.3 $ $Date: 2001/05/08 03:37:02 $ */ public interface Connector { @@ -140,6 +140,20 @@ * @param container The new Container to use */ public void setContainer(Container container); + + +/** + * Return the "disable DNS lookups" flag. + */ +public boolean getDisableLookups(); + + +/** + * Set the "disable DNS lookups" flag. + * + * @param disableLookups The new "disable DNS lookups" flag value + */ +public void setDisableLookups(boolean disableLookups); /** 1.13 +32 -4 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.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- HttpConnector.java2001/04/12 01:06:12 1.12 +++ HttpConnector.java2001/05/08 03:37:02 1.13 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v 1.12 2001/04/12 01:06:12 craigmcc Exp $ - * $Revision: 1.12 $ - * $Date: 2001/04/12 01:06:12 $ + * $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 $ * * * @@ -95,7 +95,7 @@ * * @author Craig R. McClanahan * @author Remy Maucherat - * @version $Revision: 1.12 $ $Date: 2001/04/12 01:06:12 $ + * @version $Revision: 1.13 $ $Date: 2001/05/08 03:37:02 $ */ @@ -150,6 +150,12 @@ /** + * The "disable DNS lookups" flag for this Connector. + */ +private boolean disableLookups = false; + + +/** * The server socket factory for this component. */ private ServerSocketFactory factory = null; @@ -456,6 +462,28 @@ public void setDebug(int debug) { this.debug = debug; + +} + + +/** + * Return the "disable DNS lookups" flag. + */ +public boolean getDisableLookups() { + +return (this.disableLookups); + +} + + +/** + * Set the "disable DNS lookups" flag. + * + * @param disableLookups The new "di
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10 HttpConnector.java HttpProcessor.java
craigmcc01/04/11 18:06:14 Modified:catalina/docs/config http11.html catalina/src/conf server.xml catalina/src/share/org/apache/catalina/connector/http HttpConnector.java HttpProcessor.java catalina/src/share/org/apache/catalina/connector/http10 HttpConnector.java HttpProcessor.java Log: Improve support for running Tomcat 4.0 behind a proxy server. You can now configure a Connector so that it reports configured values for the request.getServerName() and request.getServerPort(), instead of the values that the Connector itself is already running on. Note that, when a webapp is proxied in this manner, Tomcat handles *all* requests for this webapp (rather than having Apache serve the static content). User documentation for setting up Apache's mod_proxy module for use with Tomcat is on the "catalina/docs/config/http11.html" page. Revision ChangesPath 1.3 +96 -0 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.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- http11.html 2001/01/14 04:17:05 1.2 +++ http11.html 2001/04/12 01:06:11 1.3 @@ -134,6 +134,31 @@ + +proxyName + + If specified, this value will be used as the value returned by + request.getServerName(), instead of the value included + on the Host header. This is useful when running Tomcat + behind a proxy server (or a web server acting as a proxy server) + on a different host. See + Proxy Support, below, for more + information on running behind a proxy server. + + + + +proxyPort + + If specified, this value will be used as the value returned by + request.getServerPort(), instead of the value specified + by the port attribute. This is useful when running + Tomcat behind a proxy server (or a web server acting as a proxy server). + See Proxy Support, below, for more + information about running behind a proxy server. + + + @@ -237,6 +262,77 @@ Successful use of SSL support requires that you have installed the JAR files from the Java Secure Sockets Extension (JSSE) package into your conf/server directory. + + +Proxy Support + +The proxyName and proxyPort attributes can be used +when Tomcat is run behind a proxy server. These attributes modify the values +returned to web applications by the request.getServerName() and +request.getServerPort() methods, which are often used to construct +absolute URLs for redirects. Using the modified values will cause redirected +requests to be flowed through the proxy server as well, instead of directly to +the port on which Tomcat is listening. + +Proxy support can take many forms. The following outline assumes that you +are running Tomcat behind an Apache web server (listening to port 80) on the +same server that Tomcat is running on, and you wish to have all requests flow +through Apache, but forward requests for a particular web application to +Tomcat for processing. + +Configure your copy of Apache so that it includes the +mod_proxy module. If you are building from source, the +easiest way to do this is to include the --enable-module=proxy +directive on the ./configure command line. +Include two directives in your httpd.conf file for each +web application that you wish to forward to Tomcat. For example: + +ProxyPass /myapp http://localhost:8081/myapp +ProxyPassReverse /myapp http://localhost:8081/myapp + +tells Apache to forward all requests sent to URLs like +http://localhost/myapp/* to be forwarded the Tomcat +connector listening on port 8081. +Configure your copy of Tomcat to have a special Connector listening +on port 8081, with appropriate proxy settings as shown below: + ++ +which will cause servlets in this web app to think that the request +was directed to www.mycompany.com on port 80. + +It is legal to omit the proxyName attribute from the + element. If you do so, the value +reported by the request.getServerName() method will be +the hostname to which Apache forwards (in the configuration described +above, it would be "localhost"). +If you also have a Tomcat connector listening on port 8080 (within the +same , the requests to either port will be +processed by exactly the same set
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10 HttpConnector.java
glenn 01/03/31 07:22:20 Modified:catalina/src/share/org/apache/catalina/connector/http10 HttpConnector.java Log: Ensure socket ignores and logs SocketPermission AccessControlException's Revision ChangesPath 1.2 +8 -4 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.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- HttpConnector.java2001/01/23 03:55:54 1.1 +++ HttpConnector.java2001/03/31 15:22:20 1.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpConnector.java,v 1.1 2001/01/23 03:55:54 remm Exp $ - * $Revision: 1.1 $ - * $Date: 2001/01/23 03:55:54 $ + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpConnector.java,v 1.2 2001/03/31 15:22:20 glenn Exp $ + * $Revision: 1.2 $ + * $Date: 2001/03/31 15:22:20 $ * * * @@ -69,6 +69,7 @@ import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; +import java.security.AccessControlException; import java.util.Stack; import java.util.Vector; import org.apache.catalina.Connector; @@ -93,7 +94,7 @@ * purposes. Not intended to be the final solution. * * @author Craig R. McClanahan - * @version $Revision: 1.1 $ $Date: 2001/01/23 03:55:54 $ + * @version $Revision: 1.2 $ $Date: 2001/03/31 15:22:20 $ */ @@ -741,6 +742,9 @@ socket = serverSocket.accept(); if (connectionTimeout > 0) socket.setSoTimeout(connectionTimeout); +} catch (AccessControlException ace) { +log("socket accept security exception: " + ace.getMessage()); +continue; } catch (IOException e) { if (started && !stopped) log("accept: ", e);