aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--NEWS2
-rw-r--r--netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java3
-rw-r--r--netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java25
-rw-r--r--tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPProxySelectorTest.java27
5 files changed, 51 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index fe31d13..b1914d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2013-09-24 Omair Majid <[email protected]>
+
+ PR1474
+ * NEWS: Update with bug.
+ * netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java: Document
+ KEY_PROXY_SAME.
+ * netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java
+ (getFromConfiguration): Same proxy is not applicable to SOCKS. Always
+ include SOCKS proxy if available.
+ * tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPProxySelectorTest.java
+ (testHttpFallsBackToManualSocksProxy): New method.
+ (testManualSameProxy): Remove test for socket protocol.
+
2013-09-23 Omair Majid <[email protected]>
* netx/net/sourceforge/jnlp/browser/BrowserAwareProxySelector.java
diff --git a/NEWS b/NEWS
index 3c6bce1..6176cba 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,8 @@ New in release 1.5 (2013-XX-XX):
* Plugin
- PR854: Resizing an applet several times causes 100% CPU load
- PR1271: icedtea-web does not handle 'javascript:'-protocol URLs
+* Common
+ - PR1474: Can't get javaws to use SOCKS proxy
* Security Updates
- CVE-2012-4540, RH869040: Heap-based buffer overflow after triggering event attached to applet
diff --git a/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java b/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java
index 25aab36..e6f1ff1 100644
--- a/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java
+++ b/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java
@@ -129,7 +129,10 @@ public final class DeploymentConfiguration {
/** the proxy type. possible values are {@code JNLPProxySelector.PROXY_TYPE_*} */
public static final String KEY_PROXY_TYPE = "deployment.proxy.type";
+
+ /** Boolean. If true, the http host/port should be used for https and ftp as well */
public static final String KEY_PROXY_SAME = "deployment.proxy.same";
+
public static final String KEY_PROXY_AUTO_CONFIG_URL = "deployment.proxy.auto.config.url";
public static final String KEY_PROXY_BYPASS_LIST = "deployment.proxy.bypass.list";
public static final String KEY_PROXY_BYPASS_LOCAL = "deployment.proxy.bypass.local";
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java b/netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java
index b8fd25d..efcf62e 100644
--- a/netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java
@@ -298,27 +298,28 @@ public abstract class JNLPProxySelector extends ProxySelector {
String scheme = uri.getScheme();
if (sameProxy) {
- SocketAddress sa = new InetSocketAddress(proxyHttpHost, proxyHttpPort);
- Proxy proxy;
- if (scheme.equals("socket")) {
- proxy = new Proxy(Type.SOCKS, sa);
- } else {
- proxy = new Proxy(Type.HTTP, sa);
+ if (proxyHttpHost != null && (scheme.equals("https") || scheme.equals("http") || scheme.equals("ftp"))) {
+ SocketAddress sa = new InetSocketAddress(proxyHttpHost, proxyHttpPort);
+ Proxy proxy = new Proxy(Type.HTTP, sa);
+ proxies.add(proxy);
}
- proxies.add(proxy);
- } else if (scheme.equals("http")) {
+ } else if (scheme.equals("http") && proxyHttpHost != null) {
SocketAddress sa = new InetSocketAddress(proxyHttpHost, proxyHttpPort);
proxies.add(new Proxy(Type.HTTP, sa));
- } else if (scheme.equals("https")) {
+ } else if (scheme.equals("https") && proxyHttpsHost != null) {
SocketAddress sa = new InetSocketAddress(proxyHttpsHost, proxyHttpsPort);
proxies.add(new Proxy(Type.HTTP, sa));
- } else if (scheme.equals("ftp")) {
+ } else if (scheme.equals("ftp") && proxyFtpHost != null) {
SocketAddress sa = new InetSocketAddress(proxyFtpHost, proxyFtpPort);
proxies.add(new Proxy(Type.HTTP, sa));
- } else if (scheme.equals("socket")) {
+ }
+
+ if (proxySocks4Host != null) {
SocketAddress sa = new InetSocketAddress(proxySocks4Host, proxySocks4Port);
proxies.add(new Proxy(Type.SOCKS, sa));
- } else {
+ }
+
+ if (proxies.size() == 0) {
proxies.add(Proxy.NO_PROXY);
}
diff --git a/tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPProxySelectorTest.java b/tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPProxySelectorTest.java
index d522772..bef9745 100644
--- a/tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPProxySelectorTest.java
+++ b/tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPProxySelectorTest.java
@@ -45,7 +45,6 @@ import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.Proxy.Type;
-import java.net.SocketAddress;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.UnknownHostException;
@@ -116,9 +115,11 @@ public class JNLPProxySelectorTest {
assertEquals(Proxy.NO_PROXY, result.get(0));
}
+ // TODO implement this
+ @Ignore("Implement this")
@Test
public void testLocalProxyBypassListIsIgnoredForNonLocal() {
-
+ fail();
}
@Test
@@ -210,6 +211,23 @@ public class JNLPProxySelectorTest {
}
@Test
+ public void testHttpFallsBackToManualSocksProxy() throws URISyntaxException {
+ String SOCKS_HOST = "example.org";
+ int SOCKS_PORT = 42;
+
+ DeploymentConfiguration config = new DeploymentConfiguration();
+ config.setProperty(DeploymentConfiguration.KEY_PROXY_TYPE, String.valueOf(JNLPProxySelector.PROXY_TYPE_MANUAL));
+ config.setProperty(DeploymentConfiguration.KEY_PROXY_SOCKS4_HOST, SOCKS_HOST);
+ config.setProperty(DeploymentConfiguration.KEY_PROXY_SOCKS4_PORT, String.valueOf(SOCKS_PORT));
+
+ JNLPProxySelector selector = new TestProxySelector(config);
+ List<Proxy> result = selector.select(new URI("http://example.org/"));
+
+ assertEquals(1, result.size());
+ assertEquals(new Proxy(Type.SOCKS, new InetSocketAddress(SOCKS_HOST, SOCKS_PORT)), result.get(0));
+ }
+
+ @Test
public void testManualUnknownProtocolProxy() throws URISyntaxException {
DeploymentConfiguration config = new DeploymentConfiguration();
config.setProperty(DeploymentConfiguration.KEY_PROXY_TYPE, String.valueOf(JNLPProxySelector.PROXY_TYPE_MANUAL));
@@ -239,11 +257,6 @@ public class JNLPProxySelectorTest {
assertEquals(1, result.size());
assertEquals(new Proxy(Type.HTTP, new InetSocketAddress(HTTP_HOST, HTTP_PORT)), result.get(0));
-
- result = selector.select(new URI("socket://example.org/"));
-
- assertEquals(1, result.size());
- assertEquals(new Proxy(Type.SOCKS, new InetSocketAddress(HTTP_HOST, HTTP_PORT)), result.get(0));
}
@Test