Skip to content

Commit ea94ea9

Browse files
committed
disable https
1 parent 1e7b998 commit ea94ea9

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
### Fixed
10+
- Fixed HTTPS failure on installer launch. GPG is still verified.
11+
912
## [0.8.2] - 2020-02-13
1013

1114
### Changed

src/main/java/io/github/ImpactDevelopment/installer/utils/Fetcher.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@
2424

2525
import org.apache.commons.io.IOUtils;
2626

27+
import javax.net.ssl.*;
2728
import java.io.IOException;
2829
import java.net.URI;
2930
import java.net.URISyntaxException;
3031
import java.nio.charset.StandardCharsets;
32+
import java.security.cert.X509Certificate;
3133

3234
/**
3335
* Put all the URL fetching in one place so that it can be logged
@@ -38,6 +40,30 @@ public static String fetch(String url) {
3840
}
3941

4042
public static byte[] fetchBytes(String url) {
43+
try {
44+
TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() {
45+
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
46+
return null;
47+
}
48+
49+
public void checkClientTrusted(X509Certificate[] certs, String authType) {
50+
}
51+
52+
public void checkServerTrusted(X509Certificate[] certs, String authType) {
53+
}
54+
}};
55+
SSLContext sc = SSLContext.getInstance("SSL");
56+
sc.init(null, trustAllCerts, new java.security.SecureRandom());
57+
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
58+
HostnameVerifier allHostsValid = new HostnameVerifier() {
59+
public boolean verify(String hostname, SSLSession session) {
60+
return true;
61+
}
62+
};
63+
HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
64+
} catch (Throwable th) {
65+
th.printStackTrace();
66+
}
4167
System.out.println("DOWNLOADING " + url);
4268
try {
4369
return IOUtils.toByteArray(new URI(url));

0 commit comments

Comments
 (0)