check update over proxy

This commit is contained in:
2015-02-02 21:46:43 +01:00
parent 2e4f94f7c2
commit ba56044ad4
4 changed files with 24 additions and 8 deletions
+15 -8
View File
@@ -1351,15 +1351,22 @@ public class Main {
return false;
}
String acceptVersions = "";
for (String a : accepted) {
if (!acceptVersions.isEmpty()) {
acceptVersions += ",";
}
acceptVersions += a;
}
String acceptVersions = String.join(",", accepted);
try {
Socket sock = new Socket("www.free-decompiler.com", 80);
String proxyAddress = Configuration.updateProxyAddress.get();
Socket sock;
if (proxyAddress != null) {
int port = 8080;
if (proxyAddress.contains(":")) {
String[] parts = proxyAddress.split(":");
port = Integer.parseInt(parts[1]);
proxyAddress = parts[0];
}
sock = new Socket(proxyAddress, port);
} else {
sock = new Socket("www.free-decompiler.com", 80);
}
OutputStream os = sock.getOutputStream();
String currentLoc = Configuration.locale.get("en");
os.write(("GET /flash/update.html?action=check&currentVersion=" + URLEncoder.encode(currentVersion, "UTF-8")