[yum-commits] 2 commits - urlgrabber/grabber.py

zpavlas at osuosl.org zpavlas at osuosl.org
Mon May 20 14:24:44 UTC 2013


 urlgrabber/grabber.py |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

New commits:
commit 8d2501e0b4a41ebf534aed468a117f47e671b174
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date:   Mon May 20 13:11:21 2013 +0200

    Add the "minrate" option. BZ 964298
    
    There are use cases when 1000B/s is still too much.
    Other may want to change this to much larger values.

diff --git a/urlgrabber/grabber.py b/urlgrabber/grabber.py
index 37d1297..05ea9c3 100644
--- a/urlgrabber/grabber.py
+++ b/urlgrabber/grabber.py
@@ -92,6 +92,12 @@ GENERAL ARGUMENTS (kwargs)
     the curl documentation on CURLOPT_CONNECTTIMEOUT for more information.
     http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTCONNECTTIMEOUT
 
+  minrate = 1000
+
+    This sets the low speed threshold in bytes per second. If the server
+    is sending data slower than this for at least `timeout' seconds, the
+    library aborts the connection.
+
   bandwidth = 0
 
     the nominal max bandwidth in bytes/second.  If throttle is a float
@@ -955,6 +961,7 @@ class URLGrabberOptions:
         self.opener = None
         self.cache_openers = True
         self.timeout = 300
+        self.minrate = None
         self.text = None
         self.http_headers = None
         self.ftp_headers = None
@@ -1382,7 +1389,7 @@ class PyCurlFileObject(object):
         if hasattr(opts, 'timeout'):
             timeout = int(opts.timeout or 0)
         self.curl_obj.setopt(pycurl.CONNECTTIMEOUT, timeout)
-        self.curl_obj.setopt(pycurl.LOW_SPEED_LIMIT, 1000)
+        self.curl_obj.setopt(pycurl.LOW_SPEED_LIMIT, opts.minrate or 1000)
         self.curl_obj.setopt(pycurl.LOW_SPEED_TIME, timeout)
 
         # ssl options
@@ -2015,7 +2022,7 @@ class _ExternalDownloader:
     # list of options we pass to downloader
     _options = (
         'url', 'filename',
-        'timeout', 'close_connection', 'keepalive',
+        'timeout', 'minrate', 'close_connection', 'keepalive',
         'throttle', 'bandwidth', 'range', 'reget',
         'user_agent', 'http_headers', 'ftp_headers',
         'proxy', 'prefix', 'username', 'password',
commit 32ec3e4732a1bf9603cf910f848bf2f1c3800309
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date:   Fri May 17 10:06:37 2013 +0200

    Revert "Enable GSSNEGOTIATE when curl >= 7.28.0  BZ 892070."
    
    This reverts commit 9b9a1db530511197d98df076dc97a13252d69711.

diff --git a/urlgrabber/grabber.py b/urlgrabber/grabber.py
index da15319..37d1297 100644
--- a/urlgrabber/grabber.py
+++ b/urlgrabber/grabber.py
@@ -1426,11 +1426,9 @@ class PyCurlFileObject(object):
         # proxy
         if opts.proxy is not None:
             self.curl_obj.setopt(pycurl.PROXY, opts.proxy)
-            auth = pycurl.HTTPAUTH_ANY
-            if pycurl.version_info()[2] < (7 << 16 | 28 << 8 | 0):
-                # BZ 769254: work around a bug in curl < 7.28.0
-                auth &= ~pycurl.HTTPAUTH_GSSNEGOTIATE
-            self.curl_obj.setopt(pycurl.PROXYAUTH, auth)
+            self.curl_obj.setopt(pycurl.PROXYAUTH,
+                # All but Kerberos.  BZ 769254
+                pycurl.HTTPAUTH_ANY - pycurl.HTTPAUTH_GSSNEGOTIATE)
 
         if opts.username and opts.password:
             if self.scheme in ('http', 'https'):


More information about the Yum-commits mailing list