Closed brettcannon closed 16 years ago
For instance, ftplib.FTP reads from sockets using socket.makefile(), but in text mode. That's bad when the data could be in the format of ASCII or binary data.
Actually the 'r' flag is used against the control connection which is not supposed to receive any "binary" data and in FTP.retrlines method which is supposed to retrieve data in line mode.
So can we close this?
Function result type should be the same of the connection is in text mode or binary mode. As far as I remember, the text mode converts the newline byte sequence, not the charset. A text file could be stored as latin-1, utf-8, koi-8 or anything else. Am I wrong?
ftplib should use byte strings (as I did for POP3, IMAP4 or some other libraries) because the FTP protocol doesn't send the charset.
So it's already possible to receive/send raw bytes, and forget my previous message.
I see a potential but minor problem: if the server is running a POSIX OS, it's not possible to open / rename / unlink a file with an invalid name. ftp might allow bytes filename, but I prefer to leave ftplib unchanged. If your FTP server is broken, fix your file system, fix your configuration or use an old FTP client to fix the problem.
So can we close this?
Yes: retrbinary() and storbinary() can be used to get/send bytes.
Reopen the issue (or open another one) if we miss another problem.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields: ```python assignee = None closed_at =
created_at =
labels = ['library']
title = 'ftplib needs a rewrite to use bytes/buffers'
updated_at =
user = 'https://github.com/brettcannon'
```
bugs.python.org fields:
```python
activity =
actor = 'vstinner'
assignee = 'none'
closed = True
closed_date =
closer = 'vstinner'
components = ['Library (Lib)']
creation =
creator = 'brett.cannon'
dependencies = []
files = []
hgrepos = []
issue_num = 1248
keywords = []
message_count = 6.0
messages = ['56281', '73553', '75007', '75052', '75056', '75360']
nosy_count = 4.0
nosy_names = ['brett.cannon', 'vstinner', 'giampaolo.rodola', 'benjamin.peterson']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue1248'
versions = ['Python 3.0']
```