对于我的开发机器,我想禁用HTTPS连接的SSL主机名检查。调度代码产生的异常是:
javax.net.ssl.SSLException: hostname in certificate didn't match: <localhost> != <*.mydomain.com> OR <*.mydomain.com> OR <mydomain.com>
at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:228) ~[httpclient-4.1.3.jar:4.1.3]
at org.apache.http.conn.ssl.BrowserCompatHostnameVerifier.verify(BrowserCompatHostnameVerifier.java:54) ~[httpclient-4.1.3.jar:4.1.3]
at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:149) ~[httpclient-4.1.3.jar:4.1.3]
at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:130) ~[httpclient-4.1.3.jar:4.1.3]
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:397) ~[httpclient-4.1.3.jar:4.1.3]
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:148) ~[httpclient-4.1.3.jar:4.1.3]
我正在寻找一种以分派方式使用的方式设置默认主机名验证程序的方法。有a method on the deprecated HttpsURLConnection来设置默认主机名验证程序,但显然已弃用整个类。目前有正确的方法吗?
答案 0 :(得分:0)
com.sun.net.ssl.HttpsURLConnection已弃用javax.net.ssl.HttpsURLConnection;后者不被弃用。
关于绕过此检查的方法,您可以: