Mailinglist Archive: zypp-commit (275 mails)
| < Previous | Next > |
[zypp-commit] <libzypp> SuSE-SLE-10-SP3-Branch : Fix evaluation of no_proxy entries (bnc #543337)
- From: Michael Andres <ma@xxxxxxx>
- Date: Thu, 1 Oct 2009 14:49:52 +0200
- Message-id: <E1MtLAd-0001ch-Mj@xxxxxxxxxxxxxxxx>
ref: refs/heads/SuSE-SLE-10-SP3-Branch
commit 15e34ae55c10698596ad7648535d510f4f722ec1
Author: Michael Andres <ma@xxxxxxx>
Date: Thu Oct 1 14:44:46 2009 +0200
Fix evaluation of no_proxy entries (bnc #543337)
---
zypp/media/MediaCurl.cc | 46 ++--------------------------------------------
1 files changed, 2 insertions(+), 44 deletions(-)
diff --git a/zypp/media/MediaCurl.cc b/zypp/media/MediaCurl.cc
index 50781f6..52b3b0e 100644
--- a/zypp/media/MediaCurl.cc
+++ b/zypp/media/MediaCurl.cc
@@ -527,53 +527,11 @@ void MediaCurl::attachTo (bool next)
_proxy += ":" + proxyport;
}
} else {
-
ProxyInfo proxy_info (ProxyInfo::ImplPtr(new ProxyInfoSysconfig("proxy")));
-
- if ( proxy_info.enabled())
- {
- bool useproxy = true;
-
- std::list<std::string> nope = proxy_info.noProxy();
- for (ProxyInfo::NoProxyIterator it = proxy_info.noProxyBegin();
- it != proxy_info.noProxyEnd();
- it++)
- {
- std::string host( str::toLower(_url.getHost()));
- std::string temp( str::toLower(*it));
-
- // no proxy if it points to a suffix
- // preceeded by a '.', that maches
- // the trailing portion of the host.
- if( temp.size() > 1 && temp.at(0) == '.')
- {
- if(host.size() > temp.size() &&
- host.compare(host.size() - temp.size(), temp.size(), temp) == 0)
- {
- DBG << "NO_PROXY: '" << *it << "' matches host '"
- << host << "'" << endl;
- useproxy = false;
- break;
- }
- }
- else
- // no proxy if we have an exact match
- if( host == temp)
- {
- DBG << "NO_PROXY: '" << *it << "' matches host '"
- << host << "'" << endl;
- useproxy = false;
- break;
- }
- }
-
- if ( useproxy ) {
- _proxy = proxy_info.proxy(_url.getScheme());
- }
- }
+ if ( proxy_info.useProxyFor( url ) )
+ _proxy = proxy_info.proxy( _url.getScheme() );
}
-
DBG << "Proxy: " << (_proxy.empty() ? "-none-" : _proxy) << endl;
if ( ! _proxy.empty() ) {
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx
commit 15e34ae55c10698596ad7648535d510f4f722ec1
Author: Michael Andres <ma@xxxxxxx>
Date: Thu Oct 1 14:44:46 2009 +0200
Fix evaluation of no_proxy entries (bnc #543337)
---
zypp/media/MediaCurl.cc | 46 ++--------------------------------------------
1 files changed, 2 insertions(+), 44 deletions(-)
diff --git a/zypp/media/MediaCurl.cc b/zypp/media/MediaCurl.cc
index 50781f6..52b3b0e 100644
--- a/zypp/media/MediaCurl.cc
+++ b/zypp/media/MediaCurl.cc
@@ -527,53 +527,11 @@ void MediaCurl::attachTo (bool next)
_proxy += ":" + proxyport;
}
} else {
-
ProxyInfo proxy_info (ProxyInfo::ImplPtr(new ProxyInfoSysconfig("proxy")));
-
- if ( proxy_info.enabled())
- {
- bool useproxy = true;
-
- std::list<std::string> nope = proxy_info.noProxy();
- for (ProxyInfo::NoProxyIterator it = proxy_info.noProxyBegin();
- it != proxy_info.noProxyEnd();
- it++)
- {
- std::string host( str::toLower(_url.getHost()));
- std::string temp( str::toLower(*it));
-
- // no proxy if it points to a suffix
- // preceeded by a '.', that maches
- // the trailing portion of the host.
- if( temp.size() > 1 && temp.at(0) == '.')
- {
- if(host.size() > temp.size() &&
- host.compare(host.size() - temp.size(), temp.size(), temp) == 0)
- {
- DBG << "NO_PROXY: '" << *it << "' matches host '"
- << host << "'" << endl;
- useproxy = false;
- break;
- }
- }
- else
- // no proxy if we have an exact match
- if( host == temp)
- {
- DBG << "NO_PROXY: '" << *it << "' matches host '"
- << host << "'" << endl;
- useproxy = false;
- break;
- }
- }
-
- if ( useproxy ) {
- _proxy = proxy_info.proxy(_url.getScheme());
- }
- }
+ if ( proxy_info.useProxyFor( url ) )
+ _proxy = proxy_info.proxy( _url.getScheme() );
}
-
DBG << "Proxy: " << (_proxy.empty() ? "-none-" : _proxy) << endl;
if ( ! _proxy.empty() ) {
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx
| < Previous | Next > |