*** ftplib.py.orig Sat Oct 4 00:40:24 2003 --- ftplib.py Sat Oct 11 21:40:54 2003 *************** *** 71,76 **** --- 71,81 ---- CRLF = '\r\n' + # Special character in telnet protocol; used in clients and servers + # that strictly implement RFC 959 + from telnetlib import IAC + + # The class itself class FTP: *************** *** 102,108 **** # Initialize host to localhost, port to standard ftp port # Optional arguments are host (for connect()), # and user, passwd, acct (for login()) ! def __init__(self, host='', user='', passwd='', acct=''): if host: self.connect(host) if user: self.login(user, passwd, acct) --- 107,116 ---- # Initialize host to localhost, port to standard ftp port # Optional arguments are host (for connect()), # and user, passwd, acct (for login()) ! def __init__(self, host='', user='', passwd='', acct='', ! # be (or not be) strict about telnet options in the command channel ! strict_rfc959=False): ! self.strict_rfc959 = strict_rfc959 if host: self.connect(host) if user: self.login(user, passwd, acct) *************** *** 165,170 **** --- 173,180 ---- # Internal: send one line to the server, appending CRLF def putline(self, line): + if self.strict_rfc959: + line = line.replace(IAC, IAC+IAC) line = line + CRLF if self.debugging > 1: print '*put*', self.sanitize(line) self.sock.sendall(line)