diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-09-27 21:49:47 +0000 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-09-27 21:49:47 +0000 |
commit | be17a117211a4e4cc08573852fedebd5a74d0229 (patch) | |
tree | c517ed22507e0b2a22d83bc446efc4ddc0cd0544 /Lib/ftplib.py | |
parent | f2e9368021d8e22e3dce5c201fea111660d75ee1 (diff) | |
download | cpython-git-be17a117211a4e4cc08573852fedebd5a74d0229.tar.gz |
Merged revisions 66634 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r66634 | benjamin.peterson | 2008-09-26 21:49:54 -0500 (Fri, 26 Sep 2008) | 7 lines
give ftplib a real test suite
A asyncore based mock ftp server is used to test the protocol.
This is all thanks to Giampaolo Rodola #3939
(Barry gave me permission to do this before final on IRC.)
........
Diffstat (limited to 'Lib/ftplib.py')
-rw-r--r-- | Lib/ftplib.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/ftplib.py b/Lib/ftplib.py index b64e45ec4b..c75b31740c 100644 --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -71,6 +71,7 @@ all_errors = (Error, IOError, EOFError) # Line terminators (we always output CRLF, but accept any of CRLF, CR, LF) CRLF = '\r\n' +B_CRLF = b'\r\n' # The class itself class FTP: @@ -472,9 +473,9 @@ class FTP: while 1: buf = fp.readline() if not buf: break - if buf[-2:] != CRLF: - if buf[-1] in CRLF: buf = buf[:-1] - buf = buf + CRLF + if buf[-2:] != B_CRLF: + if buf[-1] in B_CRLF: buf = buf[:-1] + buf = buf + B_CRLF conn.sendall(buf) if callback: callback(buf) conn.close() |