summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--emailcommon/src/com/android/emailcommon/utility/SSLSocketFactory.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/emailcommon/src/com/android/emailcommon/utility/SSLSocketFactory.java b/emailcommon/src/com/android/emailcommon/utility/SSLSocketFactory.java
index 4d19e158c..7a0c24c1c 100644
--- a/emailcommon/src/com/android/emailcommon/utility/SSLSocketFactory.java
+++ b/emailcommon/src/com/android/emailcommon/utility/SSLSocketFactory.java
@@ -335,6 +335,10 @@ public class SSLSocketFactory implements LayeredSocketFactory {
// Set Server Name Indication if is available for this socket
setSocketHostname(sslsock, host);
+ // Start handshake prior to hostname verification to ensure
+ // handshake exceptions do not get silenced by hostname verification.
+ sslsock.startHandshake();
+
try {
hostnameVerifier.verify(host, sslsock);
// verifyHostName() didn't blowup - good!
@@ -402,6 +406,10 @@ public class SSLSocketFactory implements LayeredSocketFactory {
// Set Server Name Indication if it's available for this socket
setSocketHostname(sslSocket, host);
+ // Start handshake prior to hostname verification to ensure
+ // handshake exceptions do not get silenced by hostname verification.
+ sslSocket.startHandshake();
+
hostnameVerifier.verify(host, sslSocket);
// verifyHostName() didn't blowup - good!
return sslSocket;