tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@locus.apache.org
Subject cvs commit: jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup Catalina.java
Date Sat, 22 Apr 2000 23:15:52 GMT
craigmcc    00/04/22 16:15:51

  Modified:    proposals/catalina/src/bin catalina.bat catalina.sh
               proposals/catalina/src/conf server.xml
               proposals/catalina/src/share/org/apache/tomcat/connector
                        HttpRequestBase.java HttpResponseBase.java
               proposals/catalina/src/share/org/apache/tomcat/connector/test
                        HttpConnector.java HttpProcessor.java
               proposals/catalina/src/share/org/apache/tomcat/core
                        DummyContainer.java StandardServer.java
               proposals/catalina/src/share/org/apache/tomcat/logger
                        LoggerBase.java
               proposals/catalina/src/share/org/apache/tomcat/startup
                        Catalina.java
  Added:       proposals/catalina/src/conf dummy.xml
  Log:
  Clean up initially discovered bugs in request/response processing.  If
  you start Catalina with:
  
  	./bin/catalina.sh start -config conf/dummy.xml
  
  you can now send a request to the dummy container that this configures,
  and it will return you "snoop" style information about the request.  This
  can be a useful starting point for debugging new connectors.
  
  Also includes a modified version of a security patch suggested by
  <william-joseph.middleton@telenor.com> to require that a client attempting
  to shut down Catalina must initiate the connection from the same host that
  the server is running on (as well as know the correct passphrase).  The
  modifications are a workaround to a bug in the IBM 1.1.8 JDK for Linux,
  which returns the octets of an IP address in reverse order in some
  circumstances.
  
  Revision  Changes    Path
  1.3       +3 -13     jakarta-tomcat/proposals/catalina/src/bin/catalina.bat
  
  Index: catalina.bat
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/bin/catalina.bat,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- catalina.bat	2000/04/21 23:38:11	1.2
  +++ catalina.bat	2000/04/22 23:15:48	1.3
  @@ -68,19 +68,19 @@
   goto cleanup
   
   :startServer
  -echo Starting Catalina in new window
  +rem Starting Catalina in new window
   echo Using classpath: %CLASSPATH%
   start java org.apache.tomcat.startup.Catalina %2 %3 %4 %5 %6 %7 %8 %9 start
   goto cleanup
   
   :runServer
  -rem Start the Catalina Server
  +rem Starting Catalina in existing window
   echo Using classpath: %CLASSPATH%
   java org.apache.tomcat.startup.Catalina %2 %3 %4 %5 %6 %7 %8 %9 start
   goto cleanup
   
   :stopServer
  -rem Stop the Catalina Server
  +rem Stopping Catalina
   echo Using classpath: %CLASSPATH%
   java org.apache.tomcat.startup.Catalina -stop %2 %3 %4 %5 %6 %7 %8 %9 stop
   goto cleanup
  @@ -90,19 +90,9 @@
   
   :cleanup
   rem clean up
  -
   set CATALINA_HOME=%catalinahome%
   set TOMCAT_HOME=%tomcathome%
   set CLASSPATH=%cp%
  -set port=
  -set host=
  -set test=
  -set jsdkJars=
  -set jspJars=
  -set beanJars=
  -set miscJars=
  -set appJars=
  -set appClassPath=
   set cp=
   
   rem pause
  
  
  
  1.3       +1 -10     jakarta-tomcat/proposals/catalina/src/bin/catalina.sh
  
  Index: catalina.sh
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/bin/catalina.sh,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- catalina.sh	2000/04/21 23:38:11	1.2
  +++ catalina.sh	2000/04/22 23:15:48	1.3
  @@ -1,17 +1,9 @@
   #!/bin/sh
   #
  -# $Id: catalina.sh,v 1.2 2000/04/21 23:38:11 craigmcc Exp $
  +# $Id: catalina.sh,v 1.3 2000/04/22 23:15:48 craigmcc Exp $
   
   # Shell script to start and stop the server
   
  -# There are other, simpler commands to startup the runner. The two
  -# commented commands good replacements. The first works well with
  -# Java Platform 1.1 based runtimes. The second works well with
  -# Java2 Platform based runtimes.
  -
  -#jre -cp runner.jar:servlet.jar:classes org.apache.tomcat.shell.Startup $*
  -#java -cp runner.jar:servlet.jar:classes org.apache.tomcat.shell.Startup $*
  -
   if [ -f $HOME/.catalinarc ] ; then 
     . $HOME/.catalinarc
   fi
  @@ -69,7 +61,6 @@
   done
   
   CLASSPATH=${CLASSPATH}:${JAVA_HOME}/lib/tools.jar
  -echo XXX $CLASSPATH
   
   
   # Backdoor classpath setting for development purposes when all classes
  
  
  
  1.6       +2 -1      jakarta-tomcat/proposals/catalina/src/conf/server.xml
  
  Index: server.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/conf/server.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- server.xml	2000/04/21 23:38:11	1.5
  +++ server.xml	2000/04/22 23:15:49	1.6
  @@ -7,7 +7,8 @@
     <!-- Define all the connectors to associate with the following container -->
   
     <Connector className="org.apache.tomcat.connector.test.HttpConnector"
  -             acceptCount="10" maxProcessors="20" port="8080"/>
  +             port="8080" acceptCount="10"
  +	     minProcessors="2" maxProcessors="20"/>
   
     <!-- Define the top level container in our container hierarchy -->
   
  
  
  
  1.1                  jakarta-tomcat/proposals/catalina/src/conf/dummy.xml
  
  Index: dummy.xml
  ===================================================================
  <!-- Server Configuration With Dummy Container -->
  
  <Server port="8005" shutdown="SHUTDOWN">
  
    <Connector className="org.apache.tomcat.connector.test.HttpConnector"
               port="8080" acceptCount="10"
               minProcessors="2" maxProcessors="20"/>
  
    <Engine className="org.apache.tomcat.core.DummyContainer">
      <Logger className="org.apache.tomcat.logger.FileLogger"
              directory="logs" prefix="dummy_log." suffix=".txt"
              timestamp="true"/>
    </Engine>
  
  </Server>
  
  
  
  1.5       +22 -16    jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/HttpRequestBase.java
  
  Index: HttpRequestBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/HttpRequestBase.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- HttpRequestBase.java	2000/04/17 18:39:47	1.4
  +++ HttpRequestBase.java	2000/04/22 23:15:49	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/HttpRequestBase.java,v
1.4 2000/04/17 18:39:47 craigmcc Exp $
  - * $Revision: 1.4 $
  - * $Date: 2000/04/17 18:39:47 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/HttpRequestBase.java,v
1.5 2000/04/22 23:15:49 craigmcc Exp $
  + * $Revision: 1.5 $
  + * $Date: 2000/04/22 23:15:49 $
    *
    * ====================================================================
    *
  @@ -92,7 +92,7 @@
    * be implemented.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.4 $ $Date: 2000/04/17 18:39:47 $
  + * @version $Revision: 1.5 $ $Date: 2000/04/22 23:15:49 $
    */
   
   public class HttpRequestBase
  @@ -256,7 +256,13 @@
        */
       public void addHeader(String name, String value) {
   
  -	headers.put(name.toLowerCase(), value);
  +	name = name.toLowerCase();
  +	Vector values = (Vector) headers.get(name);
  +	if (values == null) {
  +	    values = new Vector();
  +	    headers.put(name, values);
  +	}
  +	values.addElement(value);
   
       }
   
  @@ -485,20 +491,20 @@
   	    } catch (IOException e) {
   		postParameters = null;
   	    }
  +	}
   
  -	    // Handle the simple cases that require no merging
  -	    if (queryParameters == null) {
  -		if (postParameters == null) {
  -		    parameters = new Hashtable();
  -		    return;
  -		} else {
  -		    parameters = postParameters;
  -		    return;
  -		}
  -	    } else if (postParameters == null) {
  -		parameters = queryParameters;
  +	// Handle the simple cases that require no merging
  +	if (queryParameters == null) {
  +	    if (postParameters == null) {
  +		parameters = new Hashtable();
   		return;
  +	    } else {
  +		parameters = postParameters;
  +		return;
   	    }
  +	} else if (postParameters == null) {
  +	    parameters = queryParameters;
  +	    return;
   	}
   
   	// Merge the parameters retrieved from both sources
  
  
  
  1.4       +11 -9     jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/HttpResponseBase.java
  
  Index: HttpResponseBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/HttpResponseBase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HttpResponseBase.java	2000/04/18 03:45:14	1.3
  +++ HttpResponseBase.java	2000/04/22 23:15:49	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/HttpResponseBase.java,v
1.3 2000/04/18 03:45:14 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2000/04/18 03:45:14 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/HttpResponseBase.java,v
1.4 2000/04/22 23:15:49 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2000/04/22 23:15:49 $
    *
    * ====================================================================
    *
  @@ -93,7 +93,7 @@
    * methods need to be implemented.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2000/04/18 03:45:14 $
  + * @version $Revision: 1.4 $ $Date: 2000/04/22 23:15:49 $
    */
   
   public class HttpResponseBase
  @@ -139,7 +139,7 @@
       /**
        * The error message set by <code>sendError()</code>.
        */
  -    protected String message = null;
  +    protected String message = getStatusMessage(HttpServletResponse.SC_OK);
   
   
       /**
  @@ -235,7 +235,7 @@
   	super.recycle();
   	cookies.removeAllElements();
   	headers.clear();
  -	message = null;
  +	message = getStatusMessage(HttpServletResponse.SC_OK);
   	status = HttpServletResponse.SC_OK;
   
       }
  @@ -416,19 +416,20 @@
   	if (isCommitted())
   	    return;
   
  -	// Prepare a suitable output stream
  -	OutputStreamWriter osr = null;
  +	// Prepare a suitable output writer
  +	OutputStreamWriter osr =
   	    new OutputStreamWriter(getStream(), getCharacterEncoding());
   	PrintWriter outputWriter = new PrintWriter(osr);
   
   	// Send the "Status:" header
   	outputWriter.print(request.getRequest().getProtocol());
  +	outputWriter.print(" ");
   	outputWriter.print(status);
   	if (message != null) {
   	    outputWriter.print(" ");
   	    outputWriter.print(message);
  -	    outputWriter.print("\r\n");
   	}
  +	outputWriter.print("\r\n");
   
   	// Send the content-length and content-type headers (if any)
   	if (getContentType() != null)
  @@ -453,6 +454,7 @@
   	}
   
   	// Add the session ID cookie if necessary
  +	// FIXME - if we used to have a session, expire the old cookie?
   	HttpServletRequest hreq = (HttpServletRequest) request.getRequest();
   	HttpSession session = getSession();
   	if ((session != null) &&
  
  
  
  1.2       +69 -14    jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpConnector.java
  
  Index: HttpConnector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpConnector.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HttpConnector.java	2000/04/21 19:50:36	1.1
  +++ HttpConnector.java	2000/04/22 23:15:50	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpConnector.java,v
1.1 2000/04/21 19:50:36 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/04/21 19:50:36 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpConnector.java,v
1.2 2000/04/22 23:15:50 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/04/22 23:15:50 $
    *
    * ====================================================================
    *
  @@ -69,6 +69,7 @@
   import java.net.ServerSocket;
   import java.net.Socket;
   import java.util.Stack;
  +import java.util.Vector;
   import org.apache.tomcat.Connector;
   import org.apache.tomcat.Container;
   import org.apache.tomcat.HttpRequest;
  @@ -90,7 +91,7 @@
    * purposes.  Not intended to be the final solution.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2000/04/21 19:50:36 $
  + * @version $Revision: 1.2 $ $Date: 2000/04/22 23:15:50 $
    */
   
   
  @@ -109,6 +110,12 @@
   
   
       /**
  +     * The set of processors that have ever been created.
  +     */
  +    private Vector created = new Vector();
  +
  +
  +    /**
        * The current number of processors that have been created.
        */
       private int curProcessors = 0;
  @@ -128,9 +135,15 @@
   
   
       /**
  +     * The minimum number of processors to start at initialization time.
  +     */
  +    protected int minProcessors = 5;
  +
  +
  +    /**
        * The maximum number of processors allowed, or <0 for unlimited.
        */
  -    private int maxProcessors = -1;
  +    private int maxProcessors = 20;
   
   
       /**
  @@ -245,6 +258,28 @@
   
   
       /**
  +     * Return the minimum number of processors to start at initialization.
  +     */
  +    public int getMinProcessors() {
  +
  +	return (minProcessors);
  +
  +    }
  +
  +
  +    /**
  +     * Set the minimum number of processors to start at initialization.
  +     *
  +     * @param minProcessors The new minimum processors
  +     */
  +    public void setMinProcessors(int minProcessors) {
  +
  +	this.minProcessors = minProcessors;
  +
  +    }
  +
  +
  +    /**
        * Return the maximum number of processors allowed, or <0 for unlimited.
        */
       public int getMaxProcessors() {
  @@ -363,7 +398,6 @@
        */
       void recycle(HttpRequest request) {
   
  -	request.recycle();
   	requests.push(request);
   
       }
  @@ -376,7 +410,6 @@
        */
       void recycle(HttpResponse response) {
   
  -	response.recycle();
   	responses.push(response);
   
       }
  @@ -444,9 +477,10 @@
   	    try {
   		((Lifecycle) processor).start();
   	    } catch (LifecycleException e) {
  -		log("newProcessor: ", e);
  +		log("HttpConnector.newProcessor: ", e);
   	    }
   	}
  +	created.addElement(processor);
   	return (processor);
   
       }
  @@ -488,7 +522,9 @@
   
   	}
   
  -	threadSync.notifyAll();
  +	synchronized (threadSync) {
  +	    threadSync.notifyAll();
  +	}
   
       }
   
  @@ -518,10 +554,12 @@
   	log("Stopping");
   
   	stopped = true;
  -	try {
  -	    threadSync.wait(5000);
  -	} catch (InterruptedException e) {
  -	    ;
  +	synchronized (threadSync) {
  +	    try {
  +		threadSync.wait(5000);
  +	    } catch (InterruptedException e) {
  +		;
  +	    }
   	}
   	thread = null;
   
  @@ -579,6 +617,14 @@
   	// Start our background thread
   	threadStart();
   
  +	// Create the specified minimum number of processors
  +	while (curProcessors < minProcessors) {
  +	    if ((maxProcessors > 0) && (curProcessors >= maxProcessors))
  +		break;
  +	    HttpProcessor processor = newProcessor();
  +	    recycle(processor);
  +	}
  +
       }
   
   
  @@ -597,7 +643,16 @@
   	lifecycle.fireLifecycleEvent(STOP_EVENT, null);
   
   	// Gracefully shut down all processors we have created
  -	;	// FIXME
  +	for (int i = created.size() - 1; i >= 0; i--) {
  +	    HttpProcessor processor = (HttpProcessor) created.elementAt(i);
  +	    if (processor instanceof Lifecycle) {
  +		try {
  +		    ((Lifecycle) processor).stop();
  +		} catch (LifecycleException e) {
  +		    log("HttpConnector.stop", e);
  +		}
  +	    }
  +	}
   
   	// Close the server socket we were using
   	if (serverSocket != null) {
  
  
  
  1.2       +24 -15    jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpProcessor.java
  
  Index: HttpProcessor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpProcessor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HttpProcessor.java	2000/04/21 19:50:36	1.1
  +++ HttpProcessor.java	2000/04/22 23:15:50	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpProcessor.java,v
1.1 2000/04/21 19:50:36 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/04/21 19:50:36 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpProcessor.java,v
1.2 2000/04/22 23:15:50 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/04/22 23:15:50 $
    *
    * ====================================================================
    *
  @@ -97,7 +97,7 @@
    * the request.  When the processor is completed, it will recycle itself.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2000/04/21 19:50:36 $
  + * @version $Revision: 1.2 $ $Date: 2000/04/22 23:15:50 $
    */
   
   final class HttpProcessor
  @@ -234,7 +234,9 @@
       void process(Socket socket) {
   
   	this.socket = socket;
  -	notify();
  +	synchronized (this) {
  +	    notify();
  +	}
   
       }
   
  @@ -573,10 +575,12 @@
   	while (!stopped) {
   
   	    // Wait for the next socket to be assigned
  -	    try {
  -		wait();
  -	    } catch (InterruptedException e) {
  -		;
  +	    synchronized (this) {
  +		try {
  +		    wait();
  +		} catch (InterruptedException e) {
  +		    ;
  +		}
   	    }
   	    if (socket == null)
   		continue;
  @@ -591,7 +595,9 @@
   
   	}
   
  -	threadSync.notifyAll();
  +	synchronized (threadSync) {
  +	    threadSync.notifyAll();
  +	}
   
       }
   
  @@ -602,7 +608,8 @@
       private void threadStart() {
   
   	if (threadName == null)
  -	    threadName = connector.getThreadName() + "[" + id + "]";
  +	    threadName = "HttpProcessor[" + connector.getPort() +
  +		"][" + id + "]";
   
   	log("Starting");
   
  @@ -622,10 +629,12 @@
   
   	stopped = true;
   	process(null);
  -	try {
  -	    threadSync.wait(5000);
  -	} catch (InterruptedException e) {
  -	    ;
  +	synchronized (threadSync) {
  +	    try {
  +		threadSync.wait(5000);
  +	    } catch (InterruptedException e) {
  +		;
  +	    }
   	}
   	thread = null;
   
  
  
  
  1.2       +20 -18    jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/DummyContainer.java
  
  Index: DummyContainer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/DummyContainer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DummyContainer.java	2000/04/21 22:00:25	1.1
  +++ DummyContainer.java	2000/04/22 23:15:50	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/DummyContainer.java,v
1.1 2000/04/21 22:00:25 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/04/21 22:00:25 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/DummyContainer.java,v
1.2 2000/04/22 23:15:50 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/04/22 23:15:50 $
    *
    * ====================================================================
    *
  @@ -84,7 +84,7 @@
    * implementations.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2000/04/21 22:00:25 $
  + * @version $Revision: 1.2 $ $Date: 2000/04/22 23:15:50 $
    */
   
   public final class DummyContainer
  @@ -164,13 +164,11 @@
       public void invoke(Request request, Response response)
   	throws IOException, ServletException {
   
  -	if (debug >= 0)
  -	    System.out.println("DummyContainer.invoke() started");
  -
   	ServletRequest sreq = request.getRequest();
   	HttpServletRequest hreq = null;
   	if (request.getRequest() instanceof HttpServletRequest)
   	    hreq = (HttpServletRequest) request.getRequest();
  +	response.getResponse().setContentType("text/html");
   	PrintWriter writer = response.getResponse().getWriter();
   
   	// Generate HTML page header
  @@ -214,13 +212,13 @@
   	    writer.println("<li><b>parameter</b> " + param + " = " +
   			   sreq.getParameter(param));  // FIXME - values
   	}
  -	writer.println("<ul><b>protocol</b> = " + sreq.getProtocol());
  -	writer.println("<ul><b>remoteAddr</b> = " + sreq.getRemoteAddr());
  -	writer.println("<ul><b>remoteHost</b> = " + sreq.getRemoteHost());
  -	writer.println("<ul><b>scheme</b> = " + sreq.getScheme());
  -	writer.println("<ul><b>serverName</b> = " + sreq.getServerName());
  -	writer.println("<ul><b>serverPort</b> = " + sreq.getServerPort());
  -	writer.println("<ul><b>isSecure</b> = " + sreq.isSecure());
  +	writer.println("<li><b>protocol</b> = " + sreq.getProtocol());
  +	writer.println("<li><b>remoteAddr</b> = " + sreq.getRemoteAddr());
  +	writer.println("<li><b>remoteHost</b> = " + sreq.getRemoteHost());
  +	writer.println("<li><b>scheme</b> = " + sreq.getScheme());
  +	writer.println("<li><b>secure</b> = " + sreq.isSecure());
  +	writer.println("<li><b>serverName</b> = " + sreq.getServerName());
  +	writer.println("<li><b>serverPort</b> = " + sreq.getServerPort());
   	writer.println("</ul>");
   	writer.println("<hr>");
   
  @@ -249,8 +247,16 @@
   			   hreq.getQueryString());
   	    writer.println("<li><b>remoteUser</b> = " +
   			   hreq.getRemoteUser());
  +	    writer.println("<li><b>requestedSessionId</b> = " +
  +			   hreq.getRequestedSessionId());
  +	    writer.println("<li><b>requestedSessionIdFromCookie</b> = " +
  +			   hreq.isRequestedSessionIdFromCookie());
  +	    writer.println("<li><b>requestedSessionIdFromURL</b> = " +
  +			   hreq.isRequestedSessionIdFromURL());
   	    writer.println("<li><b>requestURI</b> = " +
   			   hreq.getRequestURI());
  +	    writer.println("<li><b>servletPath</b> = " +
  +			   hreq.getServletPath());
   	    writer.println("<li><b>userPrincipal</b> = " +
   			   hreq.getUserPrincipal());
   	    writer.println("</ul>");
  @@ -262,10 +268,6 @@
   	writer.println("</html>");
   	writer.flush();
   	writer.close();
  -
  -	if (debug >= 0)
  -	    System.out.println("DummyContainer.invoke() finished");
  -
   
       }
   
  
  
  
  1.3       +40 -5     jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardServer.java
  
  Index: StandardServer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardServer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StandardServer.java	2000/04/21 23:38:12	1.2
  +++ StandardServer.java	2000/04/22 23:15:50	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardServer.java,v
1.2 2000/04/21 23:38:12 craigmcc Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/04/21 23:38:12 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardServer.java,v
1.3 2000/04/22 23:15:50 craigmcc Exp $
  + * $Revision: 1.3 $
  + * $Date: 2000/04/22 23:15:50 $
    *
    * ====================================================================
    *
  @@ -88,7 +88,7 @@
    * (but not required) when deploying and starting Tomcat.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2000/04/21 23:38:12 $
  + * @version $Revision: 1.3 $ $Date: 2000/04/22 23:15:50 $
    */
   
   public final class StandardServer
  @@ -267,6 +267,42 @@
   		System.exit(1);
   	    }
   
  +	    // Validate that the client is on our server
  +	    // NOTE:  This code works around a bug in the IBM 1.1.8 JVM
  +	    // for Linux, which returns the address bytes reversed!
  +	    boolean matchForward = true;
  +	    boolean matchReverse = true;
  +	    byte local[] = socket.getLocalAddress().getAddress();
  +	    byte remote[] = socket.getInetAddress().getAddress();
  +	    if ((local.length != 4) && (remote.length != 4)) {
  +		matchForward = false;	// FIXME: How long are IPv6 addresses?
  +		matchReverse = false;
  +	    }
  +	    if (matchForward) {
  +		for (int i = 0; i < 4; i++) {
  +		    if (local[i] != remote[i]) {
  +			matchForward = false;
  +			break;
  +		    }
  +		}
  +		for (int i = 0; i < 4; i++) {
  +		    if (local[i] != remote[3 - i]) {
  +			matchReverse = false;
  +			break;
  +		    }
  +		}
  +	    }
  +	    if (!matchForward && !matchReverse) {
  +		System.err.println("Invalid shutdown connection from " +
  +				   socket.getInetAddress() + " ignored");
  +		try {
  +		    socket.close();
  +		} catch (IOException e) {
  +		    ;
  +		}
  +		continue;
  +	    }
  +
   	    // Read a line of characters from the socket
   	    StringBuffer command = new StringBuffer();
   	    while (true) {
  @@ -293,7 +329,6 @@
   	    // Match against our command string
   	    boolean match = command.toString().equals(shutdown);
   	    if (match) {
  -	        System.err.println("StandardServer.await: Shutting down");
   		break;
   	    } else
   	        System.err.println("StandardServer.await: Invalid command '" +
  
  
  
  1.3       +5 -5      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/logger/LoggerBase.java
  
  Index: LoggerBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/logger/LoggerBase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LoggerBase.java	2000/01/29 07:46:34	1.2
  +++ LoggerBase.java	2000/04/22 23:15:51	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/logger/LoggerBase.java,v
1.2 2000/01/29 07:46:34 craigmcc Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/01/29 07:46:34 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/logger/LoggerBase.java,v
1.3 2000/04/22 23:15:51 craigmcc Exp $
  + * $Revision: 1.3 $
  + * $Date: 2000/04/22 23:15:51 $
    *
    * ====================================================================
    *
  @@ -79,7 +79,7 @@
    * any property setting and lifecycle methods required for configuration.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2000/01/29 07:46:34 $
  + * @version $Revision: 1.3 $ $Date: 2000/04/22 23:15:51 $
    */
   
   abstract class LoggerBase
  @@ -204,7 +204,7 @@
   
   	CharArrayWriter buf = new CharArrayWriter();
   	PrintWriter writer = new PrintWriter(buf);
  -	writer.print(msg);
  +	writer.println(msg);
   	throwable.printStackTrace(writer);
   	log(buf.toString());
   
  
  
  
  1.4       +5 -7      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/Catalina.java
  
  Index: Catalina.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/Catalina.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Catalina.java	2000/04/21 23:38:12	1.3
  +++ Catalina.java	2000/04/22 23:15:51	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/Catalina.java,v
1.3 2000/04/21 23:38:12 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2000/04/21 23:38:12 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/startup/Catalina.java,v
1.4 2000/04/22 23:15:51 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2000/04/22 23:15:51 $
    *
    * ====================================================================
    *
  @@ -87,7 +87,7 @@
    * </u>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2000/04/21 23:38:12 $
  + * @version $Revision: 1.4 $ $Date: 2000/04/22 23:15:51 $
    */
   
   public final class Catalina {
  @@ -402,7 +402,7 @@
   
           // Initialize the mapper
           XmlMapper mapper = new XmlMapper();
  -        mapper.setDebug(999);
  +	//        mapper.setDebug(999);
   
           // Configure the actions we will be using
   
  @@ -490,8 +490,6 @@
   	}
   
         // Stop the existing server
  -      System.out.println("FIXME: Stop server at port " + server.getPort() +
  -			 " with command '" + server.getShutdown() + "'");
         try {
   	  Socket socket = new Socket("localhost", server.getPort());
   	  OutputStream stream = socket.getOutputStream();
  
  
  

Mime
View raw message