RFR: JDK-8260925: HttpsURLConnection does not work with other JSSE provider. [v5]

Xue-Lei Andrew Fan xuelei at openjdk.java.net
Thu Mar 4 00:31:41 UTC 2021


On Wed, 3 Mar 2021 17:56:02 GMT, Vyom Tewari <vtewari at openjdk.org> wrote:

>> HttpsURLConnection, works with SunJSSE provider but does not work with other JSSE provider. In case of SunJSSE , HttpsURLConnection set the host name as follows
>> 
>> s = (SSLSocket)serverSocket;
>>    if (s instanceof SSLSocketImpl) {
>>           ((SSLSocketImpl)s).setHost(host);
>>    } 
>> 
>> But in case of other providers(BouncyCastleProvider )  host will not get set and "java.security.cert.CertificateException: No subject alternative name found matching IP address" exception will be thrown.
>
> Vyom Tewari has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - resolve jcheck issue.
>  - put if block which will prevent host being set twice in case of SSLSocketImpl

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

> 567:                     SSLParameters paramaters = s.getSSLParameters();
> 568:                     paramaters.setEndpointIdentificationAlgorithm("HTTPS");
> 569:                     if (!(s instanceof SSLSocketImpl)) {

Please have a comment that the host has been set previously for SSLSocketImpl.

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

> 453:                                                         host, port, true);
> 454:                 } else {
> 455: 	            s = (SSLSocket)serverSocket;

You may miss a whitespace here.

-------------

PR: https://git.openjdk.java.net/jdk/pull/2583


More information about the net-dev mailing list