Compare commits

...
2 Commits
Author SHA1 Message Date
huanghongxun 22ede84c3d Merge pull request #183 from jp8900308/master
Set a custom User-Agent, fixes optifine.net downloads
2017-08-15 23:43:05 +08:00
Jean-Paul Bergeron 0c4da069b7 Set a custom User-Agent, fixes optifine.net downloads 2017-08-15 07:23:03 -07:00
@@ -40,6 +40,7 @@ public final class NetUtils {
public static HttpURLConnection createConnection(URL url, Proxy proxy) throws IOException {
HttpURLConnection con = (HttpURLConnection) url.openConnection(proxy);
con.setRequestProperty("User-Agent", "Hello Minecraft!");
con.setDoInput(true);
con.setUseCaches(false);
con.setConnectTimeout(15000);
@@ -48,7 +49,9 @@ public final class NetUtils {
}
public static String get(String url, String encoding) throws IOException {
return IOUtils.toString(new URL(url).openConnection().getInputStream());
HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection();
con.setRequestProperty("User-Agent", "Hello Minecraft!");
return IOUtils.toString(con.getInputStream());
}
public static String get(String url) throws IOException {