[yum-commits] urlgrabber/grabber.py

zpavlas at osuosl.org zpavlas at osuosl.org
Tue Aug 6 08:29:20 UTC 2013


 urlgrabber/grabber.py |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

New commits:
commit d506a50c593f09bb1034f2e16c3f352953f48b5f
Author: Jacob Kjaergaard <jacob.kjaergaard at prevas.dk>
Date:   Tue Aug 6 08:39:44 2013 +0200

    add ftp_disable_epsv option. BZ 849177
    
    Curl uses EPSV by default and falls back to PASV. Some FTP servers
    or proxies don't handle EPSV correctly and the client times out before
    falling back to PASV. This option may be used to skip the timeout.

diff --git a/urlgrabber/grabber.py b/urlgrabber/grabber.py
index 6b409e3..b8faf6b 100644
--- a/urlgrabber/grabber.py
+++ b/urlgrabber/grabber.py
@@ -311,6 +311,13 @@ GENERAL ARGUMENTS (kwargs)
     actually measured to the default speed, with default
     period of 30 days.
 
+  ftp_disable_epsv = False
+
+    False, True
+
+    This options disables Extended Passive Mode (the EPSV command)
+    which does not work correctly on some buggy ftp servers.
+
 
 RETRY RELATED ARGUMENTS
 
@@ -988,6 +995,7 @@ class URLGrabberOptions:
         self.timedhosts = None
         self.half_life = 30*24*60*60 # 30 days
         self.default_speed = 1e6 # 1 MBit
+        self.ftp_disable_epsv = False
         
     def __repr__(self):
         return self.format()
@@ -1452,7 +1460,11 @@ class PyCurlFileObject(object):
         if opts.data:
             self.curl_obj.setopt(pycurl.POST, True)
             self.curl_obj.setopt(pycurl.POSTFIELDS, _to_utf8(opts.data))
-            
+
+        # ftp
+        if opts.ftp_disable_epsv:
+            self.curl_obj.setopt(pycurl.FTP_USE_EPSV, False)
+
         # our url
         self.curl_obj.setopt(pycurl.URL, self.url)
         
@@ -2034,6 +2046,7 @@ class _ExternalDownloader:
         'ssl_key_pass',
         'ssl_verify_peer', 'ssl_verify_host',
         'size', 'max_header_size', 'ip_resolve',
+        'ftp_disable_epsv'
     )
 
     def start(self, opts):


More information about the Yum-commits mailing list