[issue25458] ftplib: command response shift - mismatch

Ivan Pozdeev report at bugs.python.org
Fri Dec 9 14:09:00 EST 2016


Ivan Pozdeev added the comment:

The solution for the OP's problem is:

* after closing the data socket (whether it was returned by `transfercmd()'/`ntransfercmd()' or opened manually), an additional `FTP.getresp()'/`FTP.voidresp()' is required to process the 226 response.

The built-in `retrbinary()' and `retrlines()' do implement this logic.

But the documentation doesn't mention this requirement in `transfercmd()'/ntransfercmd()` entries (and `getresp()'/`voidresp()' are undocumented outright).

`urllib' authors have fallen into this same trap: they use `transfercmd' directly but don't call `voidresp()' afterwards.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25458>
_______________________________________


More information about the Python-bugs-list mailing list