diff options
| author | 2010-07-14 22:39:19 -0700 | |
|---|---|---|
| committer | 2010-07-14 22:39:19 -0700 | |
| commit | 521e9aa7523220c3dc48f6abd32fad6b76eea114 (patch) | |
| tree | 183a2ea1c952f998838c5c2cb07f0866acbfd995 | |
| parent | c74034b6bf0940dc80c4d4efa1e677ad0d2dfd6c (diff) | |
| parent | c98e431119867dbc4ae3da52d5c374607c0f67b9 (diff) | |
am c98e4311: am 468c82e4: Merge "Skip hostname verification when using insecure factory" into froyo
Merge commit 'c98e431119867dbc4ae3da52d5c374607c0f67b9' into gingerbread-plus-aosp
* commit 'c98e431119867dbc4ae3da52d5c374607c0f67b9':
Skip hostname verification when using insecure factory
| -rw-r--r-- | core/java/android/net/SSLCertificateSocketFactory.java | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/core/java/android/net/SSLCertificateSocketFactory.java b/core/java/android/net/SSLCertificateSocketFactory.java index 9ad125b312e1..31acb5b177e8 100644 --- a/core/java/android/net/SSLCertificateSocketFactory.java +++ b/core/java/android/net/SSLCertificateSocketFactory.java @@ -247,13 +247,16 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { /** * {@inheritDoc} * - * <p>This method verifies the peer's certificate hostname after connecting. + * <p>This method verifies the peer's certificate hostname after connecting + * (unless created with {@link #getInsecure(int, SSLSessionCache)}). */ @Override public Socket createSocket(Socket k, String host, int port, boolean close) throws IOException { OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket(k, host, port, close); s.setHandshakeTimeout(mHandshakeTimeoutMillis); - verifyHostname(s, host); + if (mSecure) { + verifyHostname(s, host); + } return s; } @@ -305,7 +308,8 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { /** * {@inheritDoc} * - * <p>This method verifies the peer's certificate hostname after connecting. + * <p>This method verifies the peer's certificate hostname after connecting + * (unless created with {@link #getInsecure(int, SSLSessionCache)}). */ @Override public Socket createSocket(String host, int port, InetAddress localAddr, int localPort) @@ -313,20 +317,25 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory { OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket( host, port, localAddr, localPort); s.setHandshakeTimeout(mHandshakeTimeoutMillis); - verifyHostname(s, host); + if (mSecure) { + verifyHostname(s, host); + } return s; } /** * {@inheritDoc} * - * <p>This method verifies the peer's certificate hostname after connecting. + * <p>This method verifies the peer's certificate hostname after connecting + * (unless created with {@link #getInsecure(int, SSLSessionCache)}). */ @Override public Socket createSocket(String host, int port) throws IOException { OpenSSLSocketImpl s = (OpenSSLSocketImpl) getDelegate().createSocket(host, port); s.setHandshakeTimeout(mHandshakeTimeoutMillis); - verifyHostname(s, host); + if (mSecure) { + verifyHostname(s, host); + } return s; } |