Commit b4be8a39 authored by 张永's avatar 张永

判断SSL为空

parent e8694dbb
......@@ -123,7 +123,9 @@ public class HttpsUtil {
requestUrl = requestUrl + (requestUrl.contains("?") ? (requestUrl.endsWith("&") ? "" : "&") : "?") + requestBody;
URL GET_URL = new URL(requestUrl);
connection = (HttpsURLConnection) (proxy == null ? GET_URL.openConnection() : GET_URL.openConnection(proxy));
connection.setSSLSocketFactory(sslSocketFactory);
if(sslSocketFactory != null) {
connection.setSSLSocketFactory(sslSocketFactory);
}
connection.setRequestMethod("GET");
connection.setRequestProperty("Accept-Charset", "utf-8");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
......@@ -151,7 +153,10 @@ public class HttpsUtil {
byte[] bytes = text == null ? new byte[0] : text.getBytes();
URL POST_URL = new URL(requestUrl);
connection = (HttpsURLConnection) (proxy == null ? POST_URL.openConnection() : POST_URL.openConnection(proxy));
connection.setSSLSocketFactory(sslSocketFactory);
if(sslSocketFactory != null) {
connection.setSSLSocketFactory(sslSocketFactory);
}
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestMethod("POST");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment