/hg/icedtea-web: PR1474: Can't get javaws to use SOCKS proxy
omajid at icedtea.classpath.org
omajid at icedtea.classpath.org
Tue Sep 24 10:42:41 PDT 2013
changeset a69671b1e1f1 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=a69671b1e1f1
author: Omair Majid <omajid at redhat.com>
date: Tue Sep 24 13:42:31 2013 -0400
PR1474: Can't get javaws to use SOCKS proxy
If there is a SOCKS proxy specified, use it for https, http,
and ftp protocols too (as a fallback).
'sameProxy' now affects the https, http and ftp protocols,
but not the socket protocol.
diffstat:
ChangeLog | 13 ++++
NEWS | 2 +
netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java | 3 +
netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java | 25 ++++----
tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPProxySelectorTest.java | 27 +++++++--
5 files changed, 51 insertions(+), 19 deletions(-)
diffs (150 lines):
diff -r bd8e09edc806 -r a69671b1e1f1 ChangeLog
--- a/ChangeLog Mon Sep 23 12:34:25 2013 -0400
+++ b/ChangeLog Tue Sep 24 13:42:31 2013 -0400
@@ -1,3 +1,16 @@
+2013-09-24 Omair Majid <omajid at redhat.com>
+
+ 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 <omajid at rehdat.com>
* netx/net/sourceforge/jnlp/browser/BrowserAwareProxySelector.java
diff -r bd8e09edc806 -r a69671b1e1f1 NEWS
--- a/NEWS Mon Sep 23 12:34:25 2013 -0400
+++ b/NEWS Tue Sep 24 13:42:31 2013 -0400
@@ -21,6 +21,8 @@
* 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 -r bd8e09edc806 -r a69671b1e1f1 netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java
--- a/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java Mon Sep 23 12:34:25 2013 -0400
+++ b/netx/net/sourceforge/jnlp/config/DeploymentConfiguration.java Tue Sep 24 13:42:31 2013 -0400
@@ -129,7 +129,10 @@
/** 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 -r bd8e09edc806 -r a69671b1e1f1 netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java
--- a/netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java Mon Sep 23 12:34:25 2013 -0400
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPProxySelector.java Tue Sep 24 13:42:31 2013 -0400
@@ -298,27 +298,28 @@
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 -r bd8e09edc806 -r a69671b1e1f1 tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPProxySelectorTest.java
--- a/tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPProxySelectorTest.java Mon Sep 23 12:34:25 2013 -0400
+++ b/tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPProxySelectorTest.java Tue Sep 24 13:42:31 2013 -0400
@@ -45,7 +45,6 @@
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 @@
assertEquals(Proxy.NO_PROXY, result.get(0));
}
+ // TODO implement this
+ @Ignore("Implement this")
@Test
public void testLocalProxyBypassListIsIgnoredForNonLocal() {
-
+ fail();
}
@Test
@@ -210,6 +211,23 @@
}
@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 @@
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
More information about the distro-pkg-dev
mailing list