Skip to content

Commit 80182f9

Browse files
author
Vyom Tewari
committed
8260925: HttpsURLConnection does not work with other JSSE provider.
Reviewed-by: xuelei
1 parent dbef0ec commit 80182f9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import java.net.Proxy;
4040
import java.security.Principal;
4141
import java.security.cert.*;
42+
import java.util.List;
4243
import java.util.Objects;
4344
import java.util.StringTokenizer;
4445
import java.util.Vector;
@@ -565,6 +566,10 @@ public void afterConnect() throws IOException, UnknownHostException {
565566
// will do the spoof checks in SSLSocket.
566567
SSLParameters paramaters = s.getSSLParameters();
567568
paramaters.setEndpointIdentificationAlgorithm("HTTPS");
569+
// host has been set previously for SSLSocketImpl
570+
if (!(s instanceof SSLSocketImpl)) {
571+
paramaters.setServerNames(List.of(new SNIHostName(host)));
572+
}
568573
s.setSSLParameters(paramaters);
569574

570575
needToCheckSpoofing = false;

0 commit comments

Comments
 (0)