Use hostname verifier directly instead of instance
Instead of local instance of the default HostnameVerifier, use it
directly from HttpsURLConnection. This avoids class preloading creating
an instance of it before it's necessary.
(cherry picked from commit 928ee1e48f
)
Bug: 9984058
Change-Id: I56565afa0394dc98054abbaef06ac9bfff009e56
This commit is contained in:
@ -79,9 +79,6 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory {
|
||||
}
|
||||
};
|
||||
|
||||
private static final HostnameVerifier HOSTNAME_VERIFIER =
|
||||
HttpsURLConnection.getDefaultHostnameVerifier();
|
||||
|
||||
private SSLSocketFactory mInsecureFactory = null;
|
||||
private SSLSocketFactory mSecureFactory = null;
|
||||
private TrustManager[] mTrustManagers = null;
|
||||
@ -192,7 +189,7 @@ public class SSLCertificateSocketFactory extends SSLSocketFactory {
|
||||
if (session == null) {
|
||||
throw new SSLException("Cannot verify SSL socket without session");
|
||||
}
|
||||
if (!HOSTNAME_VERIFIER.verify(hostname, session)) {
|
||||
if (!HttpsURLConnection.getDefaultHostnameVerifier().verify(hostname, session)) {
|
||||
throw new SSLPeerUnverifiedException("Cannot verify hostname: " + hostname);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user