more work on proxies

This commit is contained in:
Ben Fry
2015-05-10 12:27:51 -04:00
parent 9c5e831ce7
commit 2721445cee
2 changed files with 51 additions and 27 deletions
+39 -14
View File
@@ -141,29 +141,54 @@ public class Preferences {
PApplet.useNativeSelect =
Preferences.getBoolean("chooser.files.native"); //$NON-NLS-1$
// So that the system proxy setting are used by default
// Use the system proxy settings by default
// https://github.com/processing/processing/issues/2643
System.setProperty("java.net.useSystemProxies", "true");
// Set http proxy for folks that require it.
// Set HTTP, HTTPS, and SOCKS proxies for individuals
// who want/need to override the system setting
// http://docs.oracle.com/javase/6/docs/technotes/guides/net/proxies.html
String proxyHost = get("proxy.host");
String proxyPort = get("proxy.port");
if (proxyHost != null && proxyHost.length() != 0 &&
proxyPort != null && proxyPort.length() != 0) {
System.setProperty("http.proxyHost", proxyHost);
System.setProperty("http.proxyPort", proxyPort);
}
// Less readable version with the Oracle style sheet:
// http://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html
handleProxy("http", "http.proxyHost", "http.proxyPort");
handleProxy("https", "https.proxyHost", "https.proxyPort");
handleProxy("socks", "socksProxyHost", "socksProxyPort");
// Set socks proxy for folks that require it.
// http://docs.oracle.com/javase/6/docs/technotes/guides/net/proxies.html
String socksProxyHost = get("socksProxy.host");
String socksProxyPort = get("socksProxy.port");
/*
String httpProxyHost = get("proxy.http.host");
String httpProxyPort = get("proxy.http.port");
if (httpProxyHost != null && httpProxyHost.length() != 0 &&
httpProxyPort != null && httpProxyPort.length() != 0) {
System.setProperty("http.proxyHost", httpProxyHost);
System.setProperty("http.proxyPort", httpProxyPort);
}
String httpsProxyHost = get("proxy.https.host");
String httpsProxyPort = get("proxy.https.port");
if (httpsProxyHost != null && httpsProxyHost.length() != 0 &&
httpsProxyPort != null && httpsProxyPort.length() != 0) {
System.setProperty("https.proxyHost", httpsProxyHost);
System.setProperty("https.proxyPort", httpsProxyPort);
}
String socksProxyHost = get("proxy.socks.host");
String socksProxyPort = get("proxy.socks.port");
if (socksProxyHost != null && socksProxyHost.length() != 0 &&
socksProxyPort != null && socksProxyPort.length() != 0) {
socksProxyPort != null && socksProxyPort.length() != 0) {
System.setProperty("socksProxyHost", socksProxyHost);
System.setProperty("socksProxyPort", socksProxyPort);
}
*/
}
static void handleProxy(String protocol, String hostProp, String portProp) {
String proxyHost = get("proxy." + protocol + ".host");
String proxyPort = get("proxy." + protocol + ".port");
if (proxyHost != null && proxyHost.length() != 0 &&
proxyPort != null && proxyPort.length() != 0) {
System.setProperty(hostProp, proxyHost);
System.setProperty(portProp, proxyPort);
}
}
+12 -13
View File
@@ -319,21 +319,20 @@ run.present.stop.color = #cccccc
# use this by default to hide the menu bar and dock on osx
#run.present.exclusive.macosx = true
# HTTP PROXY
# PROXIES
# Set a proxy server for folks that require it. This will allow the update
# checker and the contrib manager to run properly in those environments.
#proxy.host=proxy.example.com
#proxy.port=8080
proxy.host=
proxy.port=
# SOCKS PROXY
# Set a proxy server for folks that require it. This will allow the update
# checker and the contrib manager to run properly in those environments.
#socksProxy.host=proxy.example.com
#socksProxy.port=9150
socksProxy.host=
socksProxy.port=
# This changed from proxy.host and proxy.port to proxy.http.host and
# proxy.http.port in 3.0a8. In addition, https and socks were added.
proxy.http.host=
proxy.http.port=
proxy.https.host=
proxy.https.port=
proxy.socks.host=
proxy.socks.port=
# Example of usage (replace 'http' with 'https' or 'socks' as needed)
#proxy.http.host=proxy.example.com
#proxy.http.port=8080
# PDE X
pdex.autoSave.autoSaveByDefault=true