From 92493120209565d6db37fe97c5bdb2f14d6a9c25 Mon Sep 17 00:00:00 2001 From: Facundo Batista Date: Wed, 6 Jun 2007 15:13:37 +0000 Subject: FTP.ntransfercmd method now uses create_connection when passive, using the timeout received in connection time. --- Lib/ftplib.py | 4 +--- Misc/NEWS | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Lib/ftplib.py b/Lib/ftplib.py index f9b6396..3e9189e 100644 --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -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) diff --git a/Misc/NEWS b/Misc/NEWS index a477fb8..a627765 100644 --- 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. -- cgit v0.12