8260925: HttpsURLConnection does not work with other JSSE provider.

Reviewed-by: xuelei
This commit is contained in:
Vyom Tewari 2021-03-05 05:29:55 +00:00
parent dbef0ec95d
commit 80182f92db

View file

@ -39,6 +39,7 @@ import java.net.InetSocketAddress;
import java.net.Proxy;
import java.security.Principal;
import java.security.cert.*;
import java.util.List;
import java.util.Objects;
import java.util.StringTokenizer;
import java.util.Vector;
@ -565,6 +566,10 @@ final class HttpsClient extends HttpClient
// will do the spoof checks in SSLSocket.
SSLParameters paramaters = s.getSSLParameters();
paramaters.setEndpointIdentificationAlgorithm("HTTPS");
// host has been set previously for SSLSocketImpl
if (!(s instanceof SSLSocketImpl)) {
paramaters.setServerNames(List.of(new SNIHostName(host)));
}
s.setSSLParameters(paramaters);
needToCheckSpoofing = false;