From d44893223244d859057820954b8dd2e61324ad08 Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:53:47 +0000 Subject: http ftp proxy support Author: jgg Date: 1999-05-23 06:33:13 GMT http ftp proxy support --- methods/ftp.cc | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'methods/ftp.cc') diff --git a/methods/ftp.cc b/methods/ftp.cc index d72a44ea3..4686e79f8 100644 --- a/methods/ftp.cc +++ b/methods/ftp.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: ftp.cc,v 1.7 1999/04/17 23:18:11 jgg Exp $ +// $Id: ftp.cc,v 1.8 1999/05/23 06:33:13 jgg Exp $ /* ###################################################################### HTTP Aquire Method - This is the FTP aquire method for APT. @@ -910,8 +910,28 @@ bool FtpMethod::Fetch(FetchItem *Itm) } /*}}}*/ -int main() +int main(int argc,const char *argv[]) { + /* See if we should be come the http client - we do this for http + proxy urls */ + if (getenv("ftp_proxy") != 0) + { + URI Proxy = string(getenv("ftp_proxy")); + if (Proxy.Access == "http") + { + // Copy over the environment setting + char S[300]; + snprintf(S,sizeof(S),"http_proxy=%s",getenv("ftp_proxy")); + putenv(S); + + // Run the http method + string Path = flNotFile(argv[0]) + "/http"; + execl(Path.c_str(),Path.c_str()); + cerr << "Unable to invoke " << Path << endl; + exit(100); + } + } + FtpMethod Mth; return Mth.Run(); -- cgit v1.2.3