From 95d1e0a12046ff9ca1673a8df5ad5508630e2270 Mon Sep 17 00:00:00 2001 From: Random Committer Date: Fri, 20 Apr 2018 09:15:39 -0700 Subject: [PATCH] Changed socks and proxy config values to proxy.socks and proxy.http; Checking config on start for these values and set proxy/socks accordingly. --- src/main/java/com/rarchives/ripme/App.java | 6 ++++++ src/main/java/com/rarchives/ripme/utils/Proxy.java | 2 +- src/test/java/com/rarchives/ripme/tst/proxyTest.java | 12 ++++++------ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/App.java b/src/main/java/com/rarchives/ripme/App.java index f9357e62..6f650d56 100644 --- a/src/main/java/com/rarchives/ripme/App.java +++ b/src/main/java/com/rarchives/ripme/App.java @@ -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 { diff --git a/src/main/java/com/rarchives/ripme/utils/Proxy.java b/src/main/java/com/rarchives/ripme/utils/Proxy.java index 2f657b88..be3c3b7e 100644 --- a/src/main/java/com/rarchives/ripme/utils/Proxy.java +++ b/src/main/java/com/rarchives/ripme/utils/Proxy.java @@ -96,4 +96,4 @@ public class Proxy { System.setProperty("socksProxyHost", socksServer.get("server")); } -} \ No newline at end of file +} diff --git a/src/test/java/com/rarchives/ripme/tst/proxyTest.java b/src/test/java/com/rarchives/ripme/tst/proxyTest.java index 32b7958c..1d702c6b 100644 --- a/src/test/java/com/rarchives/ripme/tst/proxyTest.java +++ b/src/test/java/com/rarchives/ripme/tst/proxyTest.java @@ -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 {