diff options
Diffstat (limited to 'Lib/urllib2.py')
-rw-r--r-- | Lib/urllib2.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py index 26416193f6..2bce745e63 100644 --- a/Lib/urllib2.py +++ b/Lib/urllib2.py @@ -1399,7 +1399,8 @@ class FTPHandler(BaseHandler): raise URLError, ('ftp error: %s' % msg), sys.exc_info()[2] def connect_ftp(self, user, passwd, host, port, dirs, timeout): - fw = ftpwrapper(user, passwd, host, port, dirs, timeout) + fw = ftpwrapper(user, passwd, host, port, dirs, timeout, + persistent=False) ## fw.ftp.set_debuglevel(1) return fw @@ -1448,3 +1449,9 @@ class CacheFTPHandler(FTPHandler): del self.timeout[k] break self.soonest = min(self.timeout.values()) + + def clear_cache(self): + for conn in self.cache.values(): + conn.close() + self.cache.clear() + self.timeout.clear() |