On Wed, 3 Mar 2021 17:56:02 GMT, Vyom Tewari <vtew...@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

Reply via email to