Skip to content

Commit

Permalink
Merge pull request wso2#12042 from YasasRangika/yasas-master
Browse files Browse the repository at this point in the history
Fix errors when hostname verification is set as "DefaultAndLocalhost"
  • Loading branch information
YasasRangika authored Jun 23, 2023
2 parents c5def2c + 876b1bd commit 4a49991
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.http.conn.ssl.DefaultHostnameVerifier;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.ssl.SSLContexts;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
Expand Down Expand Up @@ -1059,7 +1060,8 @@ void populateHttpClientConfiguration() {
final String[] localhosts = { "::1", "127.0.0.1", "localhost", "localhost.localdomain" };
@Override
public boolean verify(String urlHostName, SSLSession session) {
return Arrays.asList(localhosts).contains(urlHostName);
return SSLSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER.verify(urlHostName, session)
|| Arrays.asList(localhosts).contains(urlHostName);
}
};
break;
Expand Down

0 comments on commit 4a49991

Please sign in to comment.