tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject svn commit: r365859 - in /tomcat/sandbox/java/org/apache/coyote/http11: Http11BaseProtocol.java Http11Processor.java Http11Protocol.java apr/Http11AprBaseProtocol.java apr/Http11AprProcessor.java
Date Wed, 04 Jan 2006 07:51:52 GMT
Author: costin
Date: Tue Jan  3 23:51:50 2006
New Revision: 365859

URL: http://svn.apache.org/viewcvs?rev=365859&view=rev
Log:
Update for the new apr package, remove the old ssl abstraction.

Since APR and NIO can't use the SocketFactory, nor JK - it doesn't make
any sense to keep it for anything but the old-style connector ( which
should be deprecated/removed eventually ). 
This also brings APR, NIO, JK closer in how they can deal with SSL.


Modified:
    tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java
    tomcat/sandbox/java/org/apache/coyote/http11/Http11Processor.java
    tomcat/sandbox/java/org/apache/coyote/http11/Http11Protocol.java
    tomcat/sandbox/java/org/apache/coyote/http11/apr/Http11AprBaseProtocol.java
    tomcat/sandbox/java/org/apache/coyote/http11/apr/Http11AprProcessor.java

Modified: tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java
URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java?rev=365859&r1=365858&r2=365859&view=diff
==============================================================================
--- tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java (original)
+++ tomcat/sandbox/java/org/apache/coyote/http11/Http11BaseProtocol.java Tue Jan  3 23:51:50
2006
@@ -32,11 +32,11 @@
 import org.apache.coyote.ProtocolHandler;
 import org.apache.coyote.RequestGroupInfo;
 import org.apache.tomcat.util.net.PoolTcpEndpoint;
-import org.apache.tomcat.util.net.SSLImplementation;
-import org.apache.tomcat.util.net.SSLSupport;
-import org.apache.tomcat.util.net.ServerSocketFactory;
 import org.apache.tomcat.util.net.TcpConnection;
 import org.apache.tomcat.util.net.TcpConnectionHandler;
+//import org.apache.tomcat.util.net.javaio.SSLImplementation;
+//import org.apache.tomcat.util.net.javaio.SSLSupport;
+//import org.apache.tomcat.util.net.javaio.ServerSocketFactory;
 import org.apache.tomcat.util.res.StringManager;
 
 
@@ -124,6 +124,7 @@
             throw ex;
         }
 
+        /* Endpoint should know about ssl.
         if( socketFactory!=null ) {
             Enumeration attE=attributes.keys();
             while( attE.hasMoreElements() ) {
@@ -132,6 +133,7 @@
                 socketFactory.setAttribute( key, v );
             }
         }
+        */
 
         // XXX get domain from registration
         try {
@@ -186,12 +188,13 @@
 
     // -------------------- Properties--------------------
     // 
-    protected PoolTcpEndpoint ep= PoolTcpEndpoint.getEndpoint("acc");
+    protected PoolTcpEndpoint ep= PoolTcpEndpoint.getEndpoint(null);
     
     protected boolean secure;
 
-    protected ServerSocketFactory socketFactory;
-    protected SSLImplementation sslImplementation;
+    // Old style, no longer supported by apr, nio
+    //protected ServerSocketFactory socketFactory;
+    //protected SSLImplementation sslImplementation;
     // socket factory attriubtes ( XXX replace with normal setters )
     protected Hashtable attributes = new Hashtable();
     protected String socketFactoryName=null;
@@ -646,7 +649,12 @@
                 InputStream in = socket.getInputStream();
                 OutputStream out = socket.getOutputStream();
 
-                if( proto.secure ) {
+                processor.setSecure( proto.secure );
+
+                /* This was passing the ssl info from potocol to processor.
+                 * Now endpoing knows all about ssl.
+                 * 
+                 if( proto.secure ) {
                     SSLSupport sslSupport=null;
                     if(proto.sslImplementation != null)
                         sslSupport = proto.sslImplementation.getSSLSupport(socket);
@@ -654,6 +662,7 @@
                 } else {
                     processor.setSSLSupport( null );
                 }
+                */
                 processor.setSocket( socket );
 
                 processor.process(in, out);

Modified: tomcat/sandbox/java/org/apache/coyote/http11/Http11Processor.java
URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/Http11Processor.java?rev=365859&r1=365858&r2=365859&view=diff
==============================================================================
--- tomcat/sandbox/java/org/apache/coyote/http11/Http11Processor.java (original)
+++ tomcat/sandbox/java/org/apache/coyote/http11/Http11Processor.java Tue Jan  3 23:51:50
2006
@@ -51,7 +51,7 @@
 import org.apache.tomcat.util.http.FastHttpDateFormat;
 import org.apache.tomcat.util.http.MimeHeaders;
 import org.apache.tomcat.util.net.PoolTcpEndpoint;
-import org.apache.tomcat.util.net.SSLSupport;
+//import org.apache.tomcat.util.net.javaio.SSLSupport;
 import org.apache.tomcat.util.res.StringManager;
 import org.apache.tomcat.util.threads.ThreadWithAttributes;
 
@@ -197,9 +197,14 @@
 
 
     /**
-     * SSL information.
+     * SSL information - removed, specific to old-style java io
      */
-    protected SSLSupport sslSupport;
+    // protected SSLSupport sslSupport;
+    /**
+     * SSL enabled ?
+     */
+    protected boolean ssl = false;
+    
 
 
     /**
@@ -358,6 +363,15 @@
         }
     }
 
+    public boolean getSecure() {
+        return ssl;
+    }
+
+    public void setSecure( boolean b ) {
+        ssl=b;
+    }
+
+    
     /**
      * Set Minimum size to trigger compression.
      */
@@ -662,9 +676,9 @@
     /**
      * Set the SSL information for this HTTP connection.
      */
-    public void setSSLSupport(SSLSupport sslSupport) {
+    /*public void setSSLSupport(SSLSupport sslSupport) {
         this.sslSupport = sslSupport;
-    }
+    }*/
 
 
     /**
@@ -757,6 +771,7 @@
      */
     public void process(InputStream input, OutputStream output)
         throws IOException {
+        
         ThreadWithAttributes thrA=
                 (ThreadWithAttributes)Thread.currentThread();
         RequestInfo rp = request.getRequestProcessor();
@@ -931,7 +946,7 @@
         outputBuffer.recycle();
 
         // Recycle ssl info
-        sslSupport = null;
+        //sslSupport = null;
     }
 
 
@@ -1043,6 +1058,14 @@
         if (actionCode == ActionCode.ACTION_REQ_SSL_ATTRIBUTE ) {
 
             try {
+                if( ssl ) {
+                    Object sslO = endpoint.getSsl("cipherSuite");
+                    endpoint.getSsl("peerCertificateChain");
+                    endpoint.getSsl("keySize");
+                    endpoint.getSsl("sessionId");
+                    
+                }
+                /* TODO(costin)
                 if (sslSupport != null) {
                     Object sslO = sslSupport.getCipherSuite();
                     if (sslO != null)
@@ -1061,6 +1084,7 @@
                         request.setAttribute
                             (SSLSupport.SESSION_ID_KEY, sslO);
                 }
+                */
             } catch (Exception e) {
                 log.warn(sm.getString("http11processor.socket.ssl"), e);
             }
@@ -1117,7 +1141,7 @@
             request.setLocalPort(localPort);
 
         } else if (actionCode == ActionCode.ACTION_REQ_SSL_CERTIFICATE) {
-            if( sslSupport != null) {
+            if( ssl ) {
                 /*
                  * Consume and buffer the request body, so that it does not
                  * interfere with the client's handshake messages
@@ -1127,11 +1151,13 @@
                     .setLimit(maxSavePostSize);
                 inputBuffer.addActiveFilter
                     (inputFilters[Constants.BUFFERED_FILTER]);
+                
                 try {
-                    Object sslO = sslSupport.getPeerCertificateChain(true);
+                    Object sslO = endpoint.getSsl( PoolTcpEndpoint.CERTIFICATE_KEY );
+                    // getPeerCertificateChain(true);
                     if( sslO != null) {
                         request.setAttribute
-                            (SSLSupport.CERTIFICATE_KEY, sslO);
+                            (PoolTcpEndpoint.CERTIFICATE_KEY, sslO);
                     }
                 } catch (Exception e) {
                     log.warn(sm.getString("http11processor.socket.ssl"), e);
@@ -1177,7 +1203,7 @@
         http09 = false;
         contentDelimitation = false;
         expectation = false;
-        if (sslSupport != null) {
+        if (ssl) {
             request.scheme().setString("https");
         }
         MessageBytes protocolMB = request.protocol();
@@ -1393,7 +1419,7 @@
         }
 
         if (colonPos < 0) {
-            if (sslSupport == null) {
+            if (!ssl) {
                 // 80 - Default HTTP port
                 request.setServerPort(80);
             } else {
@@ -1524,6 +1550,8 @@
         }
 
         // APR: sendfile
+        // if someone set the right attributes in req, we'll send the file
+        //
         sendfileSupport(outputFilters);
 
         // Check for compression

Modified: tomcat/sandbox/java/org/apache/coyote/http11/Http11Protocol.java
URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/Http11Protocol.java?rev=365859&r1=365858&r2=365859&view=diff
==============================================================================
--- tomcat/sandbox/java/org/apache/coyote/http11/Http11Protocol.java (original)
+++ tomcat/sandbox/java/org/apache/coyote/http11/Http11Protocol.java Tue Jan  3 23:51:50 2006
@@ -38,11 +38,11 @@
 import org.apache.coyote.RequestGroupInfo;
 import org.apache.coyote.RequestInfo;
 import org.apache.tomcat.util.net.PoolTcpEndpoint;
-import org.apache.tomcat.util.net.SSLImplementation;
-import org.apache.tomcat.util.net.SSLSupport;
-import org.apache.tomcat.util.net.ServerSocketFactory;
 import org.apache.tomcat.util.net.TcpConnection;
 import org.apache.tomcat.util.net.TcpConnectionHandler;
+import org.apache.tomcat.util.net.javaio.SSLImplementation;
+import org.apache.tomcat.util.net.javaio.SSLSupport;
+import org.apache.tomcat.util.net.javaio.ServerSocketFactory;
 import org.apache.tomcat.util.res.StringManager;
 import org.apache.tomcat.util.threads.ThreadPool;
 import org.apache.tomcat.util.threads.ThreadWithAttributes;

Modified: tomcat/sandbox/java/org/apache/coyote/http11/apr/Http11AprBaseProtocol.java
URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/apr/Http11AprBaseProtocol.java?rev=365859&r1=365858&r2=365859&view=diff
==============================================================================
--- tomcat/sandbox/java/org/apache/coyote/http11/apr/Http11AprBaseProtocol.java (original)
+++ tomcat/sandbox/java/org/apache/coyote/http11/apr/Http11AprBaseProtocol.java Tue Jan  3
23:51:50 2006
@@ -25,8 +25,8 @@
 import org.apache.coyote.RequestGroupInfo;
 import org.apache.coyote.http11.Constants;
 import org.apache.coyote.http11.Http11BaseProtocol;
-import org.apache.tomcat.util.net.AprEndpoint;
-import org.apache.tomcat.util.net.AprEndpoint.Handler;
+import org.apache.tomcat.util.net.apr.AprEndpoint;
+import org.apache.tomcat.util.net.apr.AprEndpoint.Handler;
 
 
 /**

Modified: tomcat/sandbox/java/org/apache/coyote/http11/apr/Http11AprProcessor.java
URL: http://svn.apache.org/viewcvs/tomcat/sandbox/java/org/apache/coyote/http11/apr/Http11AprProcessor.java?rev=365859&r1=365858&r2=365859&view=diff
==============================================================================
--- tomcat/sandbox/java/org/apache/coyote/http11/apr/Http11AprProcessor.java (original)
+++ tomcat/sandbox/java/org/apache/coyote/http11/apr/Http11AprProcessor.java Tue Jan  3 23:51:50
2006
@@ -40,7 +40,8 @@
 import org.apache.tomcat.jni.Socket;
 import org.apache.tomcat.util.buf.HexUtils;
 import org.apache.tomcat.util.http.FastHttpDateFormat;
-import org.apache.tomcat.util.net.AprEndpoint;
+import org.apache.tomcat.util.net.apr.AprEndpoint;
+import org.apache.tomcat.util.net.apr.Sendfile;
 import org.apache.tomcat.util.threads.ThreadWithAttributes;
 
 
@@ -91,14 +92,9 @@
     /**
      * Sendfile data.
      */
-    protected AprEndpoint.SendfileData sendfileData = null;
+    protected Sendfile.SendfileData sendfileData = null;
 
 
-    /**
-     * SSL enabled ?
-     */
-    protected boolean ssl = false;
-    
 
     /**
      * Socket associated with the current connection.
@@ -507,7 +503,7 @@
                 outputBuffer.addActiveFilter
                     (outputFilters[Constants.VOID_FILTER]);
                 contentDelimitation = true;
-                sendfileData = new AprEndpoint.SendfileData();
+                sendfileData = new Sendfile.SendfileData();
                 sendfileData.fileName = fileName;
                 sendfileData.start = 
                     ((Long) request.getAttribute("org.apache.tomcat.sendfile.start")).longValue();



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message