From f8081133c528e8c91b533b4fab6f56ae42d51ecb Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:56:39 +0000 Subject: Alfredo's no_proxy patch Author: jgg Date: 2001-02-23 05:45:27 GMT Alfredo's no_proxy patch --- methods/ftp.cc | 18 +++++++++++++++++- methods/http.cc | 26 ++++++-------------------- 2 files changed, 23 insertions(+), 21 deletions(-) (limited to 'methods') diff --git a/methods/ftp.cc b/methods/ftp.cc index 0d617dd8..e0f71239 100644 --- a/methods/ftp.cc +++ b/methods/ftp.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: ftp.cc,v 1.21 2001/02/20 07:03:18 jgg Exp $ +// $Id: ftp.cc,v 1.22 2001/02/23 05:45:27 jgg Exp $ /* ###################################################################### HTTP Aquire Method - This is the FTP aquire method for APT. @@ -125,6 +125,13 @@ bool FTPConn::Open(pkgAcqMethod *Owner) else Proxy = getenv("ftp_proxy"); + // Parse no_proxy, a , separated list of domains + if (getenv("no_proxy") != 0) + { + if (CheckDomainList(ServerName.Host,getenv("no_proxy")) == true) + Proxy = ""; + } + // Determine what host and port to use based on the proxy settings int Port = 0; string Host; @@ -1071,6 +1078,15 @@ int main(int argc,const char *argv[]) if (getenv("ftp_proxy") != 0) { URI Proxy = string(getenv("ftp_proxy")); + + // Parse no_proxy, a , separated list of domains + if (getenv("no_proxy") != 0) + { + if (CheckDomainList(Proxy.Host,getenv("no_proxy")) == true) + Proxy.Access = ""; + } + + // Run the HTTP method if (Proxy.Access == "http") { // Copy over the environment setting diff --git a/methods/http.cc b/methods/http.cc index 7347e834..9f4494dc 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: http.cc,v 1.47 2001/02/20 07:03:18 jgg Exp $ +// $Id: http.cc,v 1.48 2001/02/23 05:45:27 jgg Exp $ /* ###################################################################### HTTP Aquire Method - This is the HTTP aquire method for APT. @@ -285,27 +285,13 @@ bool ServerState::Open() else Proxy = getenv("http_proxy"); - // Parse no_proxy, a , separated list of hosts + // Parse no_proxy, a , separated list of domains if (getenv("no_proxy") != 0) { - const char *Start = getenv("no_proxy"); - for (const char *Cur = Start; true ; Cur++) - { - if (*Cur != ',' && *Cur != 0) - continue; - if (stringcasecmp(ServerName.Host.begin(),ServerName.Host.end(), - Start,Cur) == 0) - { - Proxy = ""; - break; - } - - Start = Cur + 1; - if (*Cur == 0) - break; - } - } - + if (CheckDomainList(ServerName.Host,getenv("no_proxy")) == true) + Proxy = ""; + } + // Determine what host and port to use based on the proxy settings int Port = 0; string Host; -- cgit v1.2.3