HTTPCLIENT-690: provide access to the SSLSession of SSL connections
git-svn-id: https://svn.apache.org/repos/asf/jakarta/httpcomponents/httpclient/trunk@580608 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7edb8cc47a
commit
e033a99de3
|
@ -1,5 +1,8 @@
|
||||||
Changes since release 4.0 Alpha 1
|
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
|
* [HTTPCLIENT-692] ClientConnectionManager throws InterruptedException
|
||||||
Contributed by Roland Weber <rolandw at apache.org>
|
Contributed by Roland Weber <rolandw at apache.org>
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
package org.apache.http.conn;
|
package org.apache.http.conn;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import javax.net.ssl.SSLSession;
|
||||||
|
|
||||||
import org.apache.http.HttpClientConnection;
|
import org.apache.http.HttpClientConnection;
|
||||||
import org.apache.http.HttpInetConnection;
|
import org.apache.http.HttpInetConnection;
|
||||||
|
@ -78,6 +79,26 @@ public interface ManagedClientConnection extends
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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()
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens this connection according to the given route.
|
* Opens this connection according to the given route.
|
||||||
*
|
*
|
||||||
|
|
|
@ -33,6 +33,9 @@ package org.apache.http.impl.conn;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.InetAddress;
|
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.HttpException;
|
||||||
import org.apache.http.HttpRequest;
|
import org.apache.http.HttpRequest;
|
||||||
|
@ -246,6 +249,19 @@ public abstract class AbstractClientConnAdapter
|
||||||
return wrappedConnection.isSecure();
|
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
|
// non-javadoc, see interface ManagedClientConnection
|
||||||
public void markReusable() {
|
public void markReusable() {
|
||||||
markedReusable = true;
|
markedReusable = true;
|
||||||
|
|
Loading…
Reference in New Issue