[issue28931] urllib ignores FTP 226 response, breaking further FTP requests
Ivan Pozdeev
report at bugs.python.org
Sat Dec 10 10:17:39 EST 2016
Ivan Pozdeev added the comment:
The attached patch fixes this case. It still leaves the following problem:
>>> u=urllib.urlopen("ftp://ftp.zlatkovic.com/pub/libxml/md5sum.txt").read()
>>> urllib.urlretrieve("ftp://ftp.zlatkovic.com/pub/libxml/md5sum.txt","t.bin")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Py\lib\urllib.py", line 98, in urlretrieve
return opener.retrieve(url, filename, reporthook, data)
File "C:\Py\lib\urllib.py", line 245, in retrieve
fp = self.open(url, data)
File "C:\Py\lib\urllib.py", line 213, in open
return getattr(self, name)(url)
File "C:\Py\lib\urllib.py", line 558, in open_ftp
(fp, retrlen) = self.ftpcache[key].retrfile(file, type)
File "C:\Py\lib\urllib.py", line 906, in retrfile
conn, retrlen = self.ftp.ntransfercmd(cmd)
File "C:\Py\lib\ftplib.py", line 334, in ntransfercmd
host, port = self.makepasv()
File "C:\Py\lib\ftplib.py", line 312, in makepasv
host, port = parse227(self.sendcmd('PASV'))
File "C:\Py\lib\ftplib.py", line 830, in parse227
raise error_reply, resp
IOError: [Errno ftp error] 200 Type set to I
I reckon this can't be fully fixed without fixing `ftplib' first, see issue25458.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28931>
_______________________________________
More information about the Python-bugs-list
mailing list