From cb708d5e446d491e6857d0c1d989397f09217ddb Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Sat, 6 Nov 2021 01:28:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E8=AE=A2=E9=98=85?= =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/yutou/tools/other/tools.java | 2 +- src/main/java/com/yutou/tools/utils/HttpTools.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/yutou/tools/other/tools.java b/src/main/java/com/yutou/tools/other/tools.java index 4f3914f..e027f5a 100644 --- a/src/main/java/com/yutou/tools/other/tools.java +++ b/src/main/java/com/yutou/tools/other/tools.java @@ -150,7 +150,7 @@ public class tools { @RequestMapping(value="/tools/clash/get.do",produces ="text/plain;charset=utf-8") public String getClash(){ StringBuilder builder=new StringBuilder(); - String text= HttpTools.get("https://pub-api-1.bianyuan.xyz/sub?target=clash&url=https%3A%2F%2Fs.sublink.me%2Fsubscribe%2F2611%2F8rXy3HKfdI8%2Fssr%2F&insert=false&config=https%3A%2F%2Fraw.githubusercontent.com%2FACL4SSR%2FACL4SSR%2Fmaster%2FClash%2Fconfig%2FACL4SSR_Online_AdblockPlus.ini&emoji=true&list=false&tfo=false&scv=false&fdn=false&sort=false&new_name=true"); + String text= HttpTools.get("https://pub-api-1.bianyuan.xyz/sub?url=https%3A%2F%2Fs.sublink.me%2Fsubscribe%2F2611%2F8rXy3HKfdI8%2Fssr%2F&insert=false&config=https%3A%2F%2Fraw.githubusercontent.com%2FDarkatse%2FACL4SSR%2Fmaster%2FClash%2Fconfig%2FACL4SSR_Online.ini&target=clash"); String[] tmp=text.split("\n"); text=RedisTools.get("clash"); for (String s : tmp) { diff --git a/src/main/java/com/yutou/tools/utils/HttpTools.java b/src/main/java/com/yutou/tools/utils/HttpTools.java index 98083c2..9ffff5d 100644 --- a/src/main/java/com/yutou/tools/utils/HttpTools.java +++ b/src/main/java/com/yutou/tools/utils/HttpTools.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.yutou.tools.interfaces.DownloadInterface; import org.springframework.util.StringUtils; +import javax.net.ssl.HttpsURLConnection; import java.io.*; import java.net.HttpURLConnection; import java.net.URL; @@ -29,8 +30,10 @@ public class HttpTools { public static String https_get(String url, Map header) { try { - URLConnection connection; - connection = new URL(url).openConnection(); + HttpsURLConnection connection; + connection = (HttpsURLConnection) new URL(url).openConnection(); + connection.setConnectTimeout(60*1000); + connection.setReadTimeout(60*1000); connection.setRequestProperty("User-Agent", getExtUa()); if (header != null) { for (String key : header.keySet()) {