HTTPCLIENT-1287: DefaultUserTokenHandler#getUserToken to check if the connection is open prior to retrieving SSLSession.

Contributed by Noah Levitt <nlevitt at gmail.com>

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1427541 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2013-01-01 19:28:20 +00:00
parent 9ec0c13594
commit c02e1b3f75
1 changed files with 1 additions and 1 deletions

View File

@ -76,7 +76,7 @@ public class DefaultUserTokenHandler implements UserTokenHandler {
if (userPrincipal == null) {
HttpConnection conn = clientContext.getConnection();
if (conn instanceof SocketClientConnection) {
if (conn.isOpen() && conn instanceof SocketClientConnection) {
SSLSession sslsession = ((SocketClientConnection) conn).getSSLSession();
if (sslsession != null) {
userPrincipal = sslsession.getLocalPrincipal();