HTTP Proxy: useProxy=0 overrides http_* env variables
Previously, if http_proxy was set, a proxy was used even if explicitly disabled. This prevented disabling the use of a proxy which only made sense in some cases, like accessing something that runs locally. Explicitly telling SyncEvolution to ignore http_proxy is necessary because it doesn't support no_proxy. This change became necessary in the new nightly test server, which depends on http_* env vars for communication with external servers.
This commit is contained in:
parent
1b93d51e03
commit
4a0ef6f51f
1 changed files with 10 additions and 7 deletions
|
@ -1849,14 +1849,17 @@ static const char *ProxyString = "http_proxy";
|
|||
|
||||
/* Reads http_proxy from environment, if not available returns configured value */
|
||||
InitState<bool> SyncConfig::getUseProxy() const {
|
||||
char *proxy = getenv(ProxyString);
|
||||
if (!proxy ) {
|
||||
return syncPropUseProxy.getPropertyValue(*getNode(syncPropUseProxy));
|
||||
} else if (strlen(proxy)>0) {
|
||||
return InitState<bool>(true, true);
|
||||
} else {
|
||||
return InitState<bool>(false, true);
|
||||
InitState<bool> res = syncPropUseProxy.getPropertyValue(*getNode(syncPropUseProxy));
|
||||
if (!res.wasSet()) {
|
||||
// Not configured. Check environment.
|
||||
char *proxy = getenv(ProxyString);
|
||||
if (proxy && *proxy) {
|
||||
// Environment has it. Assume that it applies to us and
|
||||
// use it. TODO: check no_proxy against our sync URL.
|
||||
res = InitState<bool>(true, true);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void SyncConfig::setUseProxy(bool value, bool temporarily) { syncPropUseProxy.setProperty(*getNode(syncPropUseProxy), value, temporarily); }
|
||||
|
|
Loading…
Reference in a new issue