[issue12002] ftplib.FTP.abort fails with TypeError on Python 3.x

Giampaolo Rodola' report at bugs.python.org
Sat May 7 17:42:43 CEST 2011


Giampaolo Rodola' <g.rodola at gmail.com> added the comment:

This is a nasty one and mainly it's the reason why there are no tests for abort() method.
In FTP, ABOR command is supposed to be sent as OOB (out-of-band) "urgent" data and the dummy FTP server we're using for the funcional tests must handle this appopriately.

In practical terms this means that when the client calls self.sock.sendall(line, MSG_OOB) the server is supposed to call socket.recv(1024, MSG_OOB).
Since our server uses asyncore this becomes quite twisted to handle.
This can be avoided by setting SO_OOBINLINE which tells the server to handle the urgent data inline meaning that both plain and urgent data can be received with a normal sock.recv(1024) call.

The patch in attachment does this and also fixes FTP_TLS.abort() which is not able to accept the extra MSG_OOB flag argument.

There's a side note: on certain platforms SO_OOBINLINE has no effect, resulting in asyncore's handle_expt method being called, see:
http://code.google.com/p/pyftpdlib/source/browse/trunk/pyftpdlib/ftpserver.py#2064
I haven't handled this case in my patch because I'm not sure what platforms are broken.
I'd say we can commit this patch as-is, wait for the buildbots to turn red and then disable the test for those platforms afterwards.

----------
keywords: +patch
Added file: http://bugs.python.org/file21925/ftplib.patch

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


More information about the Python-bugs-list mailing list