RFC 959 *requires* to implemet a portion of the telnet protocol in the command channel. Without this ftlib has problems interacting with RFC959-compliant server (most Unix ftp daemons are compliant) if, e.g., a directory or a filename contains russian characters. The attched patch implements a minimal requirement (it doubles chr(255) in the .putline() method), but it allows a programer to choose if a session will be strict or not. Default value is "not strict" because most clients (even Unix clients) do not implemet this telnet option, and most Windoze servers do not implemet it. Tested with ProFTPd on GNU/Linux system.
Since I've created the issue I found there are different servers even in Unix. ProFTPd (and, I believe wu-ftpd) strictly implement telnet-in-command channel, they even don't have an option to turn it off. PureFTPd doesn't implement it. On the client side - lftp (command line client) and squid (well-known web/ftp proxy) implement telnet-in-command channel.
Other than IAC what other chars need to be doubled? As an alternative to a brand new TelnetFTP class this can be implemented as a FTP class attribute ("strict_telnet" maybe) defaulting to True.
> Other than IAC what other chars need to be doubled? Only IAC must be doubled. Also there have to be a special prefix for urgent (out-of-bound) commands (ABORt); I didn't implement that. > As an alternative to a brand new TelnetFTP class this can be implemented as a FTP class attribute ("strict_telnet" maybe) defaulting to True. See the first patch. Default value is False to preserve backward compatibility.