Skip to content

Commit d737a80

Browse files
committed
fix the issue blueberry was having in donator-info with ipv6 and http
1 parent 08023dc commit d737a80

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
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+
### Added
10+
- Even more workarounds for peoples broken network stacks!
11+
912
## [0.8.4] - 2020-02-24
1013

1114
### Added

src/main/java/io/github/ImpactDevelopment/installer/github/Github.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ private static GithubRelease[] fetchReleases(String repo) {
4343
try {
4444
return getFromURL("http://impactclient.net/releases.json");
4545
} catch (Throwable th) {
46-
System.out.println("Unable to fetch from epic site");
46+
System.out.println("Unable to fetch from epic site http");
47+
th.printStackTrace();
48+
}
49+
try {
50+
return getFromURL("https://impactclient.net/releases.json");
51+
} catch (Throwable th) {
52+
System.out.println("Unable to fetch from epic site https");
4753
th.printStackTrace();
4854
}
4955
}

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,18 @@ public static String fetch(String url) {
4040
}
4141

4242
public static byte[] fetchBytes(String url) {
43+
System.out.println("DOWNLOADING " + url);
44+
try {
45+
return IOUtils.toByteArray(new URI(url));
46+
} catch (Throwable th) {
47+
th.printStackTrace();
48+
}
4349
SSLSocketFactory originalSSL = HttpsURLConnection.getDefaultSSLSocketFactory(); // for restoring later
4450
HostnameVerifier originalHost = HttpsURLConnection.getDefaultHostnameVerifier();
45-
System.out.println("DOWNLOADING " + url);
51+
String originalIPv4 = System.getProperty("java.net.preferIPv4Stack");
4652
try {
53+
System.out.println("Trying some hacks to get this to load!");
54+
System.setProperty("java.net.preferIPv4Stack", "true");
4755
try {
4856
return IOUtils.toByteArray(new URI(url));
4957
} catch (Throwable th) {
@@ -65,6 +73,8 @@ public static byte[] fetchBytes(String url) {
6573
} catch (NoSuchAlgorithmException | KeyManagementException e) {
6674
throw new RuntimeException(e);
6775
} finally {
76+
System.out.println("Undoing hacks!");
77+
System.setProperty("java.net.preferIPv4Stack", originalIPv4);
6878
try {
6979
HttpsURLConnection.setDefaultSSLSocketFactory(originalSSL); // restore to full https verification
7080
HttpsURLConnection.setDefaultHostnameVerifier(originalHost);

0 commit comments

Comments
 (0)