hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rola...@apache.org
Subject svn commit: r580608 - in /jakarta/httpcomponents/httpclient/trunk: RELEASE_NOTES.txt module-client/src/main/java/org/apache/http/conn/ManagedClientConnection.java module-client/src/main/java/org/apache/http/impl/conn/AbstractClientConnAdapter.java
Date Sat, 29 Sep 2007 17:25:19 GMT
Author: rolandw
Date: Sat Sep 29 10:25:18 2007
New Revision: 580608

URL: http://svn.apache.org/viewvc?rev=580608&view=rev
Log:
HTTPCLIENT-690: provide access to the SSLSession of SSL connections

Modified:
    jakarta/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ManagedClientConnection.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/AbstractClientConnAdapter.java

Modified: jakarta/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt?rev=580608&r1=580607&r2=580608&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt (original)
+++ jakarta/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt Sat Sep 29 10:25:18 2007
@@ -1,5 +1,8 @@
 Changes since release 4.0 Alpha 1
 
+* [HTTPCLIENT-690] ManagedClientConnection provides access to SSLSession
+  Contributed by Roland Weber <rolandw at apache.org>
+
 * [HTTPCLIENT-692] ClientConnectionManager throws InterruptedException
   Contributed by Roland Weber <rolandw at apache.org>
 

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ManagedClientConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ManagedClientConnection.java?rev=580608&r1=580607&r2=580608&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ManagedClientConnection.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ManagedClientConnection.java
Sat Sep 29 10:25:18 2007
@@ -32,6 +32,7 @@
 package org.apache.http.conn;
 
 import java.io.IOException;
+import javax.net.ssl.SSLSession;
 
 import org.apache.http.HttpClientConnection;
 import org.apache.http.HttpInetConnection;
@@ -75,6 +76,26 @@
      *          <code>null</code> if not connected
      */
     HttpRoute getRoute()
+        ;
+
+
+    /**
+     * Obtains the SSL session of the underlying connection, if any.
+     * If this connection is open, and the underlying socket is an
+     * {@link javax.net.ssl.SSLSocket SSLSocket}, the SSL session of
+     * that socket is obtained. This is a potentially blocking operation.
+     * <br/>
+     * <b>Note:</b> Whether the underlying socket is an SSL socket
+     * can not necessarily be determined via {@link #isSecure}.
+     * Plain sockets may be considered secure, for example if they are
+     * connected to a known host in the same network segment.
+     * On the other hand, SSL sockets may be considered insecure,
+     * for example depending on the chosen cipher suite.
+     *
+     * @return  the underlying SSL session if available,
+     *          <code>null</code> otherwise
+     */
+    SSLSession getSSLSession()
         ;
 
 

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/AbstractClientConnAdapter.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/AbstractClientConnAdapter.java?rev=580608&r1=580607&r2=580608&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/AbstractClientConnAdapter.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/AbstractClientConnAdapter.java
Sat Sep 29 10:25:18 2007
@@ -33,6 +33,9 @@
 
 import java.io.IOException;
 import java.net.InetAddress;
+import java.net.Socket;
+import javax.net.ssl.SSLSocket;
+import javax.net.ssl.SSLSession;
 
 import org.apache.http.HttpException;
 import org.apache.http.HttpRequest;
@@ -244,6 +247,19 @@
     public boolean isSecure() {
         assertWrappedConn();
         return wrappedConnection.isSecure();
+    }
+
+    // non-javadoc, see interface ManagedClientConnection
+    public SSLSession getSSLSession() {
+        if (!isOpen())
+            return null;
+
+        SSLSession result = null;
+        Socket    sock    = wrappedConnection.getSocket();
+        if (sock instanceof SSLSocket) {
+            result = ((SSLSocket)sock).getSession();
+        }
+        return result;
     }
 
     // non-javadoc, see interface ManagedClientConnection



Mime
View raw message