This commit is contained in:
ChomeNS 2023-03-28 14:59:16 +07:00
parent cd2fa73976
commit 2d592284ac

View file

@ -5,8 +5,7 @@ import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager; import javax.net.ssl.X509TrustManager;
import java.io.*; import java.io.*;
import java.net.URL; import java.net.*;
import java.net.URLConnection;
import java.security.KeyManagementException; import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom; import java.security.SecureRandom;
@ -30,6 +29,7 @@ public class DownloadUtilities {
SSLContext ctx = SSLContext.getInstance("TLS"); SSLContext ctx = SSLContext.getInstance("TLS");
ctx.init(new KeyManager[0], new TrustManager[] {new DefaultTrustManager()}, new SecureRandom()); ctx.init(new KeyManager[0], new TrustManager[] {new DefaultTrustManager()}, new SecureRandom());
SSLContext.setDefault(ctx); SSLContext.setDefault(ctx);
URLConnection conn = url.openConnection(); URLConnection conn = url.openConnection();
conn.setConnectTimeout(5000); conn.setConnectTimeout(5000);
conn.setReadTimeout(10000); conn.setReadTimeout(10000);