]> granicus.if.org Git - python/commitdiff
FTP.ntransfercmd method now uses create_connection when passive,
authorFacundo Batista <facundobatista@gmail.com>
Wed, 6 Jun 2007 15:13:37 +0000 (15:13 +0000)
committerFacundo Batista <facundobatista@gmail.com>
Wed, 6 Jun 2007 15:13:37 +0000 (15:13 +0000)
using the timeout received in connection time.

Lib/ftplib.py
Misc/NEWS

index f9b6396de96182e993e897c6c39287fb7d1b0d74..3e9189e7c1835ea74311fb16b2979752d57abec6 100644 (file)
@@ -319,9 +319,7 @@ class FTP:
         size = None
         if self.passiveserver:
             host, port = self.makepasv()
-            af, socktype, proto, canon, sa = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM)[0]
-            conn = socket.socket(af, socktype, proto)
-            conn.connect(sa)
+            conn = socket.create_connection((host, port), self.timeout)
             if rest is not None:
                 self.sendcmd("REST %s" % rest)
             resp = self.sendcmd(cmd)
index a477fb8633da9f4c3f8c371fbc259237e2a3af03..a62776550712d1cd1a434465d63af43a1d9f9dce 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -222,6 +222,10 @@ Core and builtins
 Library
 -------
 
+- In ftplib, the FTP.ntransfercmd method, when in passive mode, now uses
+  the socket.create_connection function, using the timeout specified at
+  connection time.
+
 - Bug #1728403: Fix a bug that CJKCodecs StreamReader hangs when it
   reads a file that ends with incomplete sequence and sizehint argument
   for .read() is specified.