This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年05月04日 21:45 by nneonneo, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| ftplib.patch | giampaolo.rodola, 2011年05月07日 15:42 | review | ||
| Messages (4) | |||
|---|---|---|---|
| msg135158 - (view) | Author: Robert Xiao (nneonneo) * | Date: 2011年05月04日 21:45 | |
On Python 3.2, calling abort() on an ftplib.FTP object will cause an exception:
>>> ftp = ftplib.FTP('localhost')
>>> ftp.abort()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.2/ftplib.py", line 246, in abort
self.sock.sendall(line, MSG_OOB)
TypeError: 'str' does not support the buffer interface
The offending line, ftplib.py:246, should be replaced by
self.sock.sendall(line.encode(self.encoding), MSG_OOB)
|
|||
| msg135329 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年05月06日 17:02 | |
Thanks for the report. If you would like to turn your suggestion into a diff file (see guidelines at http://docs.python.org/devguide) containing the code change and a test, you could get into the Misc/ACKS file and get eternal glory :) |
|||
| msg135474 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) | Date: 2011年05月07日 15:42 | |
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. |
|||
| msg135489 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年05月07日 17:35 | |
New changeset 31220cd936d2 by Giampaolo Rodola' in branch '3.1': #12002 - ftplib's abort() method raises TypeError http://hg.python.org/cpython/rev/31220cd936d2 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:16 | admin | set | github: 56211 |
| 2011年05月17日 17:41:23 | giampaolo.rodola | set | status: open -> closed resolution: fixed stage: needs patch -> resolved |
| 2011年05月07日 17:35:49 | python-dev | set | nosy:
+ python-dev messages: + msg135489 |
| 2011年05月07日 15:42:42 | giampaolo.rodola | set | files:
+ ftplib.patch keywords: + patch messages: + msg135474 |
| 2011年05月06日 17:02:27 | eric.araujo | set | versions:
- Python 3.4 nosy: + eric.araujo messages: + msg135329 stage: needs patch |
| 2011年05月05日 12:08:34 | giampaolo.rodola | set | assignee: giampaolo.rodola |
| 2011年05月05日 11:13:31 | ezio.melotti | set | nosy:
+ giampaolo.rodola, ezio.melotti |
| 2011年05月04日 21:45:12 | nneonneo | create | |