Bug#759264: This change broke proxy support in apt for me
On Wed, Sep 10, 2014 at 05:24:37PM -0400, Lennart Sorensen wrote:
> After this change proxy handling is completely broken for me.
>
> I have this for a config:
>
> Acquire::http::Proxy-Auto-Detect "/usr/local/sbin/getproxy";
> Acquire::http::Proxy::rceng02.eng.lan "DIRECT";
> Acquire::http::Proxy::mirror.eng.lan "DIRECT";
> Acquire::http::Proxy::cache.eng.lan "DIRECT";
>
> With apt 1.0.7 it works perfectly, using direct access to sources on
> the 3 listed hosts and proxy returned by a script for everything else.
>
> With 1.0.8 it now randomly tries to use the proxy for hostnames configured
> to be direct.
>
> I highly suspect this change is the cause of the breakage.
Indeed, sorry for that. I attached a patch that should fix the issue by
not running the auto-detect if the user already has a proxy set for
the given specific host. This seems to be the most sensible option,
autodetect everything that is not set explicitly already in the config.
Cheers,
Michael
diff --git a/apt-pkg/contrib/proxy.cc b/apt-pkg/contrib/proxy.cc
index b58db84..9750f71 100644
--- a/apt-pkg/contrib/proxy.cc
+++ b/apt-pkg/contrib/proxy.cc
@@ -26,6 +26,10 @@ bool AutoDetectProxy(URI &URL)
// we support both http/https debug options
bool Debug = _config->FindB("Debug::Acquire::"+URL.Access,false);
+ // the user already explicitly set a proxy for this host
+ if(_config->FindS("Acquire::"+URL.Access+"::proxy::"+URL.Host, "") != "")
+ return true;
+
// option is "Acquire::http::Proxy-Auto-Detect" but we allow the old
// name without the dash ("-")
std::string AutoDetectProxyCmd = _config->Find("Acquire::"+URL.Access+"::Proxy-Auto-Detect",
Reply to: