You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2013/04/24 10:19:21 UTC

svn commit: r1471285 - in /httpcomponents/httpclient/branches/4.2.x: RELEASE_NOTES.txt httpclient/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java

Author: olegk
Date: Wed Apr 24 08:19:20 2013
New Revision: 1471285

URL: http://svn.apache.org/r1471285
Log:
HTTPCLIENT-1346: Ensure propagation of SSL handshake exceptions
Contributed by Pasi Eronen <pe at iki.fi>

Modified:
    httpcomponents/httpclient/branches/4.2.x/RELEASE_NOTES.txt
    httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java
    httpcomponents/httpclient/branches/4.2.x/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java

Modified: httpcomponents/httpclient/branches/4.2.x/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.2.x/RELEASE_NOTES.txt?rev=1471285&r1=1471284&r2=1471285&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.2.x/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpclient/branches/4.2.x/RELEASE_NOTES.txt Wed Apr 24 08:19:20 2013
@@ -1,8 +1,15 @@
+Changes since Release 4.2.5
+-------------------
+
+* [HTTPCLIENT-1346] Ensure propagation of SSL handshake exceptions.
+  Contributed by Pasi Eronen <pe at iki.fi>
+
+
 Release 4.2.5
 -------------------
 
 HttpClient 4.2.5 (GA) is a maintenance release that addresses a number of issues reported since 
-release 4.2.3 including a major bug that can lead to re-use of persistent connections in 
+release 4.2.4 including a major bug that can lead to re-use of persistent connections in 
  a inconsistent state.
 
 All users of HttpClient 4.2 are strongly advised to upgrade.

Modified: httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java?rev=1471285&r1=1471284&r2=1471285&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java (original)
+++ httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java Wed Apr 24 08:19:20 2013
@@ -432,6 +432,7 @@ public class SSLSocketFactory implements
             sslsock = (SSLSocket) this.socketfactory.createSocket(sock, hostname, port, true);
             prepareSocket(sslsock);
         }
+        sslsock.startHandshake();
         if (this.hostnameVerifier != null) {
             try {
                 this.hostnameVerifier.verify(hostname, sslsock);
@@ -489,6 +490,7 @@ public class SSLSocketFactory implements
               port,
               true);
         prepareSocket(sslSocket);
+        sslSocket.startHandshake();
         if (this.hostnameVerifier != null) {
             this.hostnameVerifier.verify(host, sslSocket);
         }
@@ -511,6 +513,7 @@ public class SSLSocketFactory implements
               autoClose
         );
         prepareSocket(sslSocket);
+        sslSocket.startHandshake();
         if (this.hostnameVerifier != null) {
             this.hostnameVerifier.verify(host, sslSocket);
         }

Modified: httpcomponents/httpclient/branches/4.2.x/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.2.x/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java?rev=1471285&r1=1471284&r2=1471285&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.2.x/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java (original)
+++ httpcomponents/httpclient/branches/4.2.x/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java Wed Apr 24 08:19:20 2013
@@ -39,6 +39,7 @@ import javax.net.ssl.KeyManager;
 import javax.net.ssl.KeyManagerFactory;
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLException;
+import javax.net.ssl.SSLHandshakeException;
 import javax.net.ssl.SSLPeerUnverifiedException;
 import javax.net.ssl.SSLSession;
 import javax.net.ssl.SSLSocket;
@@ -160,7 +161,7 @@ public class TestSSLSocketFactory extend
         Assert.assertTrue(hostVerifier.isFired());
     }
 
-    @Test(expected=SSLPeerUnverifiedException.class)
+    @Test(expected=SSLHandshakeException.class)
     public void testSSLTrustVerification() throws Exception {
         // Use default SSL context
         SSLContext defaultsslcontext = SSLContext.getInstance("TLS");