Example #1
0
SharedProxy GetProxyForURL(string& url)
{
    static Logger* logger = GetLogger();
    URI uri(url);

    // Don't try to detect proxy settings for URLs we know are local
    std::string scheme(uri.getScheme());
    if (scheme == "app" || scheme == "ti" || scheme == "file")
        return 0;

    if (scheme == "http" && !httpProxyOverride.isNull())
        return httpProxyOverride;

    if (scheme == "https" && !httpsProxyOverride.isNull())
        return httpsProxyOverride;

    SharedProxy environmentProxy(GetProxyFromEnvironment(scheme));
    if (!environmentProxy.isNull())
    {
        logger->Debug("Found proxy (%s) in environment",
                      environmentProxy->ToString().c_str());
        return environmentProxy;
    }

    logger->Debug("Looking up proxy information for: %s", url.c_str());
    SharedProxy proxy(ProxyConfig::GetProxyForURLImpl(uri));

    if (proxy.isNull())
        logger->Debug("Using direct connection.");
    else
        logger->Debug("Using proxy: %s", proxy->ToString().c_str());

    return proxy;
}
Example #2
0
		SharedProxy GetProxyForURL(string& url)
		{
			URI uri(url);

			// Don't try to detect proxy settings for URLs we know are local
			std::string scheme(uri.getScheme());
			if (scheme == "app" || scheme == "ti" || scheme == "file")
				return 0;

			if (scheme == "http" && !httpProxyOverride.isNull())
				return httpProxyOverride;

			if (scheme == "https" && !httpsProxyOverride.isNull())
				return httpsProxyOverride;

			return ProxyConfig::GetProxyForURLImpl(uri);
		}
Example #3
0
void Network::_GetHTTPSProxy(const ValueList& args, KValueRef result)
{
    SharedProxy proxy = ProxyConfig::GetHTTPSProxyOverride();

    if (proxy.isNull())
        result->SetNull();
    else
        result->SetString(proxy->ToString().c_str());
}