am 4c514f2a: am 594eeb08: Merge "Fix for the invalid Global Proxy Setting" into klp-dev
* commit '4c514f2a688bdae319c919987092ccfee690f390': Fix for the invalid Global Proxy Setting
This commit is contained in:
@@ -139,6 +139,17 @@ public class ProxyProperties implements Parcelable {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isValid() {
|
||||||
|
if (!TextUtils.isEmpty(mPacFileUrl)) return true;
|
||||||
|
try {
|
||||||
|
Proxy.validate(mHost == null ? "" : mHost, mPort == 0 ? "" : Integer.toString(mPort),
|
||||||
|
mExclusionList == null ? "" : mExclusionList);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public java.net.Proxy makeProxy() {
|
public java.net.Proxy makeProxy() {
|
||||||
java.net.Proxy proxy = java.net.Proxy.NO_PROXY;
|
java.net.Proxy proxy = java.net.Proxy.NO_PROXY;
|
||||||
if (mHost != null) {
|
if (mHost != null) {
|
||||||
|
|||||||
@@ -3383,6 +3383,11 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
String pacFileUrl = "";
|
String pacFileUrl = "";
|
||||||
if (proxyProperties != null && (!TextUtils.isEmpty(proxyProperties.getHost()) ||
|
if (proxyProperties != null && (!TextUtils.isEmpty(proxyProperties.getHost()) ||
|
||||||
!TextUtils.isEmpty(proxyProperties.getPacFileUrl()))) {
|
!TextUtils.isEmpty(proxyProperties.getPacFileUrl()))) {
|
||||||
|
if (!proxyProperties.isValid()) {
|
||||||
|
if (DBG)
|
||||||
|
log("Invalid proxy properties, ignoring: " + proxyProperties.toString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
mGlobalProxy = new ProxyProperties(proxyProperties);
|
mGlobalProxy = new ProxyProperties(proxyProperties);
|
||||||
host = mGlobalProxy.getHost();
|
host = mGlobalProxy.getHost();
|
||||||
port = mGlobalProxy.getPort();
|
port = mGlobalProxy.getPort();
|
||||||
@@ -3426,6 +3431,11 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
} else {
|
} else {
|
||||||
proxyProperties = new ProxyProperties(host, port, exclList);
|
proxyProperties = new ProxyProperties(host, port, exclList);
|
||||||
}
|
}
|
||||||
|
if (!proxyProperties.isValid()) {
|
||||||
|
if (DBG) log("Invalid proxy properties, ignoring: " + proxyProperties.toString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
synchronized (mProxyLock) {
|
synchronized (mProxyLock) {
|
||||||
mGlobalProxy = proxyProperties;
|
mGlobalProxy = proxyProperties;
|
||||||
}
|
}
|
||||||
@@ -3450,6 +3460,10 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
synchronized (mProxyLock) {
|
synchronized (mProxyLock) {
|
||||||
if (mDefaultProxy != null && mDefaultProxy.equals(proxy)) return;
|
if (mDefaultProxy != null && mDefaultProxy.equals(proxy)) return;
|
||||||
if (mDefaultProxy == proxy) return; // catches repeated nulls
|
if (mDefaultProxy == proxy) return; // catches repeated nulls
|
||||||
|
if (!proxy.isValid()) {
|
||||||
|
if (DBG) log("Invalid proxy properties, ignoring: " + proxy.toString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
mDefaultProxy = proxy;
|
mDefaultProxy = proxy;
|
||||||
|
|
||||||
if (mGlobalProxy != null) return;
|
if (mGlobalProxy != null) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user