Changed socks and proxy config values to proxy.socks and proxy.http; Checking config on start for these values and set proxy/socks accordingly.

This commit is contained in:
Random Committer 2018-04-20 09:15:39 -07:00
parent f493b1ed80
commit 95d1e0a120
3 changed files with 13 additions and 7 deletions

View File

@ -48,6 +48,12 @@ public class App {
System.exit(0);
}
if (Utils.getConfigString("proxy.http", null) != null) {
Proxy.setHTTPProxy(Utils.getConfigString("proxy.http", null));
} else if (Utils.getConfigString("proxy.socks", null) != null) {
Proxy.setSocks(Utils.getConfigString("proxy.socks", null));
}
if (GraphicsEnvironment.isHeadless() || args.length > 0) {
handleArguments(args);
} else {

View File

@ -9,13 +9,13 @@ import com.rarchives.ripme.utils.Http;
public class proxyTest extends TestCase {
// This test will only run on machines where the user has added a entry for socks.server
// This test will only run on machines where the user has added a entry for proxy.socks
public void testSocksProxy() throws IOException {
URL url = new URL("https://icanhazip.com");
String proxyConfig = Utils.getConfigString("socks.server", "");
String proxyConfig = Utils.getConfigString("proxy.socks", "");
if (!proxyConfig.equals("")) {
String ip1 = Http.url(url).ignoreContentType().get().text();
Proxy.setSocks(Utils.getConfigString("socks.server", ""));
Proxy.setSocks(Utils.getConfigString("proxy.socks", ""));
String ip2 = Http.url(url).ignoreContentType().get().text();
assertFalse(ip1.equals(ip2));
} else {
@ -24,13 +24,13 @@ public class proxyTest extends TestCase {
}
}
// This test will only run on machines where the user has added a entry for proxy.server
// This test will only run on machines where the user has added a entry for proxy.http
public void testHTTPProxy() throws IOException {
URL url = new URL("https://icanhazip.com");
String proxyConfig = Utils.getConfigString("proxy.server", "");
String proxyConfig = Utils.getConfigString("proxy.http", "");
if (!proxyConfig.equals("")) {
String ip1 = Http.url(url).ignoreContentType().get().text();
Proxy.setHTTPProxy(Utils.getConfigString("proxy.server", ""));
Proxy.setHTTPProxy(Utils.getConfigString("proxy.http", ""));
String ip2 = Http.url(url).ignoreContentType().get().text();
assertFalse(ip1.equals(ip2));
} else {