You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@locus.apache.org on 2000/09/09 03:55:47 UTC
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core WrappedRequest.java
craigmcc 00/09/08 18:55:47
Modified: catalina/src/share/org/apache/catalina Request.java
catalina/src/share/org/apache/catalina/connector
RequestBase.java RequestWrapper.java
catalina/src/share/org/apache/catalina/connector/http
HttpProcessor.java
catalina/src/share/org/apache/catalina/connector/test
HttpProcessor.java
catalina/src/share/org/apache/catalina/core
WrappedRequest.java
Log:
Make the underlying socket visible on a request, so that an SSL
authentication module (for running Standalone) can extract the current
SSLSession and therefore the peer certificate chain.
Revision Changes Path
1.2 +22 -4 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Request.java
Index: Request.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Request.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Request.java 2000/08/11 05:24:10 1.1
+++ Request.java 2000/09/09 01:55:44 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Request.java,v 1.1 2000/08/11 05:24:10 craigmcc Exp $
- * $Revision: 1.1 $
- * $Date: 2000/08/11 05:24:10 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Request.java,v 1.2 2000/09/09 01:55:44 craigmcc Exp $
+ * $Revision: 1.2 $
+ * $Date: 2000/09/09 01:55:44 $
*
* ====================================================================
*
@@ -67,6 +67,7 @@
import java.io.InputStream;
import java.io.IOException;
+import java.net.Socket;
import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletRequest;
@@ -78,7 +79,7 @@
* produce the corresponding <code>Response</code>.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.1 $ $Date: 2000/08/11 05:24:10 $
+ * @version $Revision: 1.2 $ $Date: 2000/09/09 01:55:44 $
*/
public interface Request {
@@ -159,6 +160,23 @@
* @param response The new associated response
*/
public void setResponse(Response response);
+
+
+ /**
+ * Return the Socket (if any) through which this Request was received.
+ * This should <strong>only</strong> be used to access underlying state
+ * information about this Socket, such as the SSLSession associated with
+ * an SSLSocket.
+ */
+ public Socket getSocket();
+
+
+ /**
+ * Set the Socket (if any) through which this Request was received.
+ *
+ * @param socket The socket through which this request was received
+ */
+ public void setSocket(Socket socket);
/**
1.4 +37 -4 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/RequestBase.java
Index: RequestBase.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/RequestBase.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RequestBase.java 2000/08/17 23:19:59 1.3
+++ RequestBase.java 2000/09/09 01:55:44 1.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/RequestBase.java,v 1.3 2000/08/17 23:19:59 craigmcc Exp $
- * $Revision: 1.3 $
- * $Date: 2000/08/17 23:19:59 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/RequestBase.java,v 1.4 2000/09/09 01:55:44 craigmcc Exp $
+ * $Revision: 1.4 $
+ * $Date: 2000/09/09 01:55:44 $
*
* ====================================================================
*
@@ -69,6 +69,7 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
+import java.net.Socket;
import java.security.Principal;
import java.util.ArrayList;
import java.util.Enumeration;
@@ -96,7 +97,7 @@
* the connector-specific methods need to be implemented.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.3 $ $Date: 2000/08/17 23:19:59 $
+ * @version $Revision: 1.4 $ $Date: 2000/09/09 01:55:44 $
*/
public abstract class RequestBase
@@ -235,6 +236,12 @@
/**
+ * The socket through which this Request was received.
+ */
+ protected Socket socket = null;
+
+
+ /**
* The ServletInputStream that has been returned by
* <code>getInputStream()</code>, if any.
*/
@@ -365,6 +372,31 @@
/**
+ * Return the Socket (if any) through which this Request was received.
+ * This should <strong>only</strong> be used to access underlying state
+ * information about this Socket, such as the SSLSession associated with
+ * an SSLSocket.
+ */
+ public Socket getSocket() {
+
+ return (this.socket);
+
+ }
+
+
+ /**
+ * Set the Socket (if any) through which this Request was received.
+ *
+ * @param socket The socket through which this request was received
+ */
+ public void setSocket(Socket socket) {
+
+ this.socket = socket;
+
+ }
+
+
+ /**
* Return the input stream associated with this Request.
*/
public InputStream getStream() {
@@ -499,6 +531,7 @@
secure = false;
serverName = null;
serverPort = -1;
+ socket = null;
stream = null;
wrapper = null;
1.2 +29 -3 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/RequestWrapper.java
Index: RequestWrapper.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/RequestWrapper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RequestWrapper.java 2000/08/11 22:40:19 1.1
+++ RequestWrapper.java 2000/09/09 01:55:44 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/RequestWrapper.java,v 1.1 2000/08/11 22:40:19 craigmcc Exp $
- * $Revision: 1.1 $
- * $Date: 2000/08/11 22:40:19 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/RequestWrapper.java,v 1.2 2000/09/09 01:55:44 craigmcc Exp $
+ * $Revision: 1.2 $
+ * $Date: 2000/09/09 01:55:44 $
*
* ====================================================================
*
@@ -67,6 +67,7 @@
import java.io.InputStream;
import java.io.IOException;
+import java.net.Socket;
import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletRequest;
@@ -84,7 +85,7 @@
* functionality that they require.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.1 $ $Date: 2000/08/11 22:40:19 $
+ * @version $Revision: 1.2 $ $Date: 2000/09/09 01:55:44 $
*/
public abstract class RequestWrapper implements Request {
@@ -238,6 +239,31 @@
public void setResponse(Response response) {
request.setResponse(response);
+
+ }
+
+
+ /**
+ * Return the Socket (if any) through which this Request was received.
+ * This should <strong>only</strong> be used to access underlying state
+ * information about this Socket, such as the SSLSession associated with
+ * an SSLSocket.
+ */
+ public Socket getSocket() {
+
+ return (request.getSocket());
+
+ }
+
+
+ /**
+ * Set the Socket (if any) through which this Request was received.
+ *
+ * @param socket The socket through which this request was received
+ */
+ public void setSocket(Socket socket) {
+
+ request.setSocket(socket);
}
1.6 +5 -4 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpProcessor.java
Index: HttpProcessor.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpProcessor.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- HttpProcessor.java 2000/09/05 23:18:47 1.5
+++ HttpProcessor.java 2000/09/09 01:55:45 1.6
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpProcessor.java,v 1.5 2000/09/05 23:18:47 craigmcc Exp $
- * $Revision: 1.5 $
- * $Date: 2000/09/05 23:18:47 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpProcessor.java,v 1.6 2000/09/09 01:55:45 craigmcc Exp $
+ * $Revision: 1.6 $
+ * $Date: 2000/09/09 01:55:45 $
*
* ====================================================================
*
@@ -107,7 +107,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
- * @version $Revision: 1.5 $ $Date: 2000/09/05 23:18:47 $
+ * @version $Revision: 1.6 $ $Date: 2000/09/09 01:55:45 $
*/
final class HttpProcessor
@@ -484,6 +484,7 @@
", port=" + connector.getPort());
((HttpRequestImpl) request).setInet(socket.getInetAddress());
request.setServerPort(connector.getPort());
+ request.setSocket(socket);
}
1.4 +5 -4 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/test/HttpProcessor.java
Index: HttpProcessor.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/test/HttpProcessor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- HttpProcessor.java 2000/09/05 23:20:05 1.3
+++ HttpProcessor.java 2000/09/09 01:55:46 1.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/test/HttpProcessor.java,v 1.3 2000/09/05 23:20:05 craigmcc Exp $
- * $Revision: 1.3 $
- * $Date: 2000/09/05 23:20:05 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/test/HttpProcessor.java,v 1.4 2000/09/09 01:55:46 craigmcc Exp $
+ * $Revision: 1.4 $
+ * $Date: 2000/09/09 01:55:46 $
*
* ====================================================================
*
@@ -104,7 +104,7 @@
* the request. When the processor is completed, it will recycle itself.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.3 $ $Date: 2000/09/05 23:20:05 $
+ * @version $Revision: 1.4 $ $Date: 2000/09/09 01:55:46 $
*/
final class HttpProcessor
@@ -339,6 +339,7 @@
", port=" + connector.getPort());
((HttpRequestImpl) request).setInet(socket.getInetAddress());
request.setServerPort(connector.getPort());
+ request.setSocket(socket);
}
1.4 +30 -4 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/WrappedRequest.java
Index: WrappedRequest.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/WrappedRequest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- WrappedRequest.java 2000/08/17 03:09:20 1.3
+++ WrappedRequest.java 2000/09/09 01:55:46 1.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/WrappedRequest.java,v 1.3 2000/08/17 03:09:20 craigmcc Exp $
- * $Revision: 1.3 $
- * $Date: 2000/08/17 03:09:20 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/WrappedRequest.java,v 1.4 2000/09/09 01:55:46 craigmcc Exp $
+ * $Revision: 1.4 $
+ * $Date: 2000/09/09 01:55:46 $
*
* ====================================================================
*
@@ -68,6 +68,7 @@
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.IOException;
+import java.net.Socket;
import java.security.Principal;
import java.util.Enumeration;
import java.util.HashMap;
@@ -112,7 +113,7 @@
* <code>parameters</code> instance variables.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.3 $ $Date: 2000/08/17 03:09:20 $
+ * @version $Revision: 1.4 $ $Date: 2000/09/09 01:55:46 $
*/
final class WrappedRequest
@@ -773,6 +774,31 @@
*/
public void setResponse(Response response) {
request.setResponse(response);
+ }
+
+
+ /**
+ * Return the Socket (if any) through which this Request was received.
+ * This should <strong>only</strong> be used to access underlying state
+ * information about this Socket, such as the SSLSession associated with
+ * an SSLSocket.
+ */
+ public Socket getSocket() {
+
+ return (request.getSocket());
+
+ }
+
+
+ /**
+ * Set the Socket (if any) through which this Request was received.
+ *
+ * @param socket The socket through which this request was received
+ */
+ public void setSocket(Socket socket) {
+
+ request.setSocket(socket);
+
}