[yum-commits] urlgrabber/grabber.py
zpavlas at osuosl.org
zpavlas at osuosl.org
Mon Feb 20 08:52:36 UTC 2012
urlgrabber/grabber.py | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
New commits:
commit ddb9e78b4bdf3f6c4a2556ba7cd1c0af88af677e
Author: ZdenÄk Pavlas <zpavlas at redhat.com>
Date: Mon Feb 20 09:49:12 2012 +0100
New ftp/http/https proxy setting code. BZ 769254, BZ 574080.
- FTP: compare strings instead of substring matching.
- HTTP/HTTPS: prefer the correct proxy string.
- PROXYAUTH set to HTTPAUTH_ANY, allowing NTLM auth.
diff --git a/urlgrabber/grabber.py b/urlgrabber/grabber.py
index 5614bcd..61e1810 100644
--- a/urlgrabber/grabber.py
+++ b/urlgrabber/grabber.py
@@ -1275,20 +1275,16 @@ class PyCurlFileObject(object):
self.curl_obj.setopt(pycurl.MAX_RECV_SPEED_LARGE, int(opts.raw_throttle()))
# proxy settings
- if opts.proxies:
- for (scheme, proxy) in opts.proxies.items():
- if self.scheme in ('ftp'): # only set the ftp proxy for ftp items
- if scheme not in ('ftp'):
- continue
- else:
- if proxy == '_none_': proxy = ""
- self.curl_obj.setopt(pycurl.PROXY, proxy)
- elif self.scheme in ('http', 'https'):
- if scheme not in ('http', 'https'):
- continue
- else:
- if proxy == '_none_': proxy = ""
- self.curl_obj.setopt(pycurl.PROXY, proxy)
+ if opts.proxies and self.scheme in ('ftp', 'http', 'https'):
+ proxy = opts.proxies.get(self.scheme)
+ if proxy is None:
+ if self.scheme == 'http':
+ proxy = opts.proxies.get('https')
+ elif self.scheme == 'https':
+ proxy = opts.proxies.get('http')
+ if proxy and proxy != '_none_':
+ self.curl_obj.setopt(pycurl.PROXY, proxy)
+ self.curl_obj.setopt(pycurl.PROXYAUTH, pycurl.HTTPAUTH_ANY)
if opts.username and opts.password:
if self.scheme in ('http', 'https'):
More information about the Yum-commits
mailing list