mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Fixed proxy authentication: previous type wasn't discarded (so http didn't work).
This commit is contained in:
parent
67ec4bf3bd
commit
2efe38b96b
1 changed files with 7 additions and 6 deletions
|
@ -102,6 +102,13 @@ public class Session {
|
||||||
System.setSecurityManager(null);
|
System.setSecurityManager(null);
|
||||||
System.setProperty("http.nonProxyHosts", "code.google.com");
|
System.setProperty("http.nonProxyHosts", "code.google.com");
|
||||||
System.setProperty("socksNonProxyHosts", "code.google.com");
|
System.setProperty("socksNonProxyHosts", "code.google.com");
|
||||||
|
|
||||||
|
// clear previous values
|
||||||
|
System.clearProperty("socksProxyHost");
|
||||||
|
System.clearProperty("socksProxyPort");
|
||||||
|
System.clearProperty("http.proxyHost");
|
||||||
|
System.clearProperty("http.proxyPort");
|
||||||
|
|
||||||
switch (connection.getProxyType()) {
|
switch (connection.getProxyType()) {
|
||||||
case SOCKS:
|
case SOCKS:
|
||||||
System.setProperty("socksProxyHost", connection.getProxyHost());
|
System.setProperty("socksProxyHost", connection.getProxyHost());
|
||||||
|
@ -112,12 +119,6 @@ public class Session {
|
||||||
System.setProperty("http.proxyPort", Integer.toString(connection.getProxyPort()));
|
System.setProperty("http.proxyPort", Integer.toString(connection.getProxyPort()));
|
||||||
Authenticator.setDefault(new MageAuthenticator(connection.getProxyUsername(), connection.getProxyPassword()));
|
Authenticator.setDefault(new MageAuthenticator(connection.getProxyUsername(), connection.getProxyPassword()));
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
System.clearProperty("socksProxyHost");
|
|
||||||
System.clearProperty("socksProxyPort");
|
|
||||||
System.clearProperty("http.proxyHost");
|
|
||||||
System.clearProperty("http.proxyPort");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
Registry reg = LocateRegistry.getRegistry(connection.getHost(), connection.getPort());
|
Registry reg = LocateRegistry.getRegistry(connection.getHost(), connection.getPort());
|
||||||
this.server = (Server) reg.lookup(Config.remoteServer);
|
this.server = (Server) reg.lookup(Config.remoteServer);
|
||||||
|
|
Loading…
Reference in a new issue