From 38d944cb0b51fb4c929037970c3de772ec756559 Mon Sep 17 00:00:00 2001 From: qi_liang Date: Mon, 9 Mar 2020 00:14:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9C=A8=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E8=AF=81=E4=B9=A6=E4=B8=8B=EF=BC=8Chttps=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/panda/code/uitl/http/HttpKit.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/panda-code/src/main/java/org/panda/code/uitl/http/HttpKit.java b/panda-code/src/main/java/org/panda/code/uitl/http/HttpKit.java index bfc1005..2175e65 100644 --- a/panda-code/src/main/java/org/panda/code/uitl/http/HttpKit.java +++ b/panda-code/src/main/java/org/panda/code/uitl/http/HttpKit.java @@ -20,11 +20,7 @@ import java.security.cert.X509Certificate; import java.util.Map; import java.util.Map.Entry; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSocketFactory; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; +import javax.net.ssl.*; /** @@ -68,6 +64,12 @@ public class HttpKit { http.setSSLSocketFactory(ssf); http.setDoOutput(true); http.setDoInput(true); + http.setHostnameVerifier(new HostnameVerifier() { + @Override + public boolean verify(String s, SSLSession sslSession) { + return true; + } + }); http.connect(); InputStream in = http.getInputStream(); @@ -133,6 +135,12 @@ public class HttpKit { http.setSSLSocketFactory(ssf); http.setDoOutput(true); http.setDoInput(true); + http.setHostnameVerifier(new HostnameVerifier() { + @Override + public boolean verify(String s, SSLSession sslSession) { + return true; + } + }); http.connect(); OutputStream out = http.getOutputStream(); out.write(params.getBytes("UTF-8"));