projects
/
apt-legacy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
https://stackoverflow.com/questions/12351460/redeclaration-of-a-variable-in-a-for...
[apt-legacy.git]
/
methods
/
ftp.cc
diff --git
a/methods/ftp.cc
b/methods/ftp.cc
index 73697d10147e1b64e8023732cd7fa8143f0391f2..3e1725823d9a16e98b20adcfe73434723d79cbde 100644
(file)
--- a/
methods/ftp.cc
+++ b/
methods/ftp.cc
@@
-1,7
+1,3
@@
-extern "C" {
- #include <mach-o/nlist.h>
-}
-
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: ftp.cc,v 1.31.2.1 2004/01/16 18:58:50 mdz Exp $
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// $Id: ftp.cc,v 1.31.2.1 2004/01/16 18:58:50 mdz Exp $
@@
-23,6
+19,7
@@
extern "C" {
#include <apt-pkg/acquire-method.h>
#include <apt-pkg/error.h>
#include <apt-pkg/hashes.h>
#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>
#include <sys/stat.h>
#include <sys/time.h>
@@
-116,23
+113,28
@@
bool FTPConn::Open(pkgAcqMethod *Owner)
Close();
// Determine the proxy setting
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
}
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)
{
// Parse no_proxy, a , separated list of domains
if (getenv("no_proxy") != 0)
{
@@
-981,7
+983,9
@@
bool FtpMethod::Fetch(FetchItem *Itm)
FetchResult Res;
Res.Filename = Itm->DestFile;
Res.IMSHit = false;
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)
{
// Connect to the server
if (Server == 0 || Server->Comp(Get) == false)
{
@@
-1090,13
+1094,6
@@
bool FtpMethod::Fetch(FetchItem *Itm)
int main(int argc,const char *argv[])
{
int main(int argc,const char *argv[])
{
- struct nlist nl[2];
- memset(nl, 0, sizeof(nl));
- nl[0].n_un.n_name = (char *) "_useMDNSResponder";
- nlist("/usr/lib/libc.dylib", nl);
- if (nl[0].n_type != N_UNDF)
- *(int *) nl[0].n_value = 0;
-
setlocale(LC_ALL, "");
/* See if we should be come the http client - we do this for http
setlocale(LC_ALL, "");
/* See if we should be come the http client - we do this for http
@@
-1112,7
+1109,7
@@
int main(int argc,const char *argv[])
char S[300];
snprintf(S,sizeof(S),"http_proxy=%s",getenv("ftp_proxy"));
putenv(S);
char S[300];
snprintf(S,sizeof(S),"http_proxy=%s",getenv("ftp_proxy"));
putenv(S);
- putenv("no_proxy=");
+ putenv(
(char *)
"no_proxy=");
// Run the http method
string Path = flNotFile(argv[0]) + "http";
// Run the http method
string Path = flNotFile(argv[0]) + "http";