[Python-checkins] r55786 - in python/trunk: Lib/ftplib.py Misc/NEWS

facundo.batista python-checkins at python.org
Wed Jun 6 17:13:42 CEST 2007


Author: facundo.batista
Date: Wed Jun  6 17:13:37 2007
New Revision: 55786

Modified:
   python/trunk/Lib/ftplib.py
   python/trunk/Misc/NEWS
Log:

FTP.ntransfercmd method now uses create_connection when passive,
using the timeout received in connection time.


Modified: python/trunk/Lib/ftplib.py
==============================================================================
--- python/trunk/Lib/ftplib.py	(original)
+++ python/trunk/Lib/ftplib.py	Wed Jun  6 17:13:37 2007
@@ -319,9 +319,7 @@
         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)

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Wed Jun  6 17:13:37 2007
@@ -222,6 +222,10 @@
 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.


More information about the Python-checkins mailing list