diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-01-26 15:51:45 +0100 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-01-26 15:51:45 +0100 |
commit | 51f9f4d78deabf54dbbb6881139d2b1a319ffbfc (patch) | |
tree | 60a2bcd8911acd5c4ab8b4558bfd30344b673ff5 /methods/ftp.cc | |
parent | 76fe5db7153957f8fda437e3bd614312b076f19e (diff) | |
parent | c1f168f54be5b4babeb9b91cd7145441ea2489ad (diff) |
merge from the mvo branch
Diffstat (limited to 'methods/ftp.cc')
-rw-r--r-- | methods/ftp.cc | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/methods/ftp.cc b/methods/ftp.cc index 554a24cf5..3e1725823 100644 --- a/methods/ftp.cc +++ b/methods/ftp.cc @@ -19,6 +19,7 @@ #include <apt-pkg/acquire-method.h> #include <apt-pkg/error.h> #include <apt-pkg/hashes.h> +#include <apt-pkg/netrc.h> #include <sys/stat.h> #include <sys/time.h> @@ -112,23 +113,28 @@ bool FTPConn::Open(pkgAcqMethod *Owner) Close(); // Determine the proxy setting - if (getenv("ftp_proxy") == 0) + string SpecificProxy = _config->Find("Acquire::ftp::Proxy::" + ServerName.Host); + if (!SpecificProxy.empty()) { - string DefProxy = _config->Find("Acquire::ftp::Proxy"); - string SpecificProxy = _config->Find("Acquire::ftp::Proxy::" + ServerName.Host); - if (SpecificProxy.empty() == false) - { - if (SpecificProxy == "DIRECT") - Proxy = ""; - else - Proxy = SpecificProxy; - } - else - Proxy = DefProxy; + if (SpecificProxy == "DIRECT") + Proxy = ""; + else + Proxy = SpecificProxy; } else - Proxy = getenv("ftp_proxy"); - + { + string DefProxy = _config->Find("Acquire::ftp::Proxy"); + if (!DefProxy.empty()) + { + Proxy = DefProxy; + } + else + { + char* result = getenv("ftp_proxy"); + Proxy = result ? result : ""; + } + } + // Parse no_proxy, a , separated list of domains if (getenv("no_proxy") != 0) { @@ -977,7 +983,9 @@ bool FtpMethod::Fetch(FetchItem *Itm) FetchResult Res; Res.Filename = Itm->DestFile; Res.IMSHit = false; - + + maybe_add_auth (Get, _config->FindFile("Dir::Etc::netrc")); + // Connect to the server if (Server == 0 || Server->Comp(Get) == false) { |