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.)
........
diff --git a/Lib/ftplib.py b/Lib/ftplib.py
index b64e45e..c75b317 100644
--- a/Lib/ftplib.py
+++ b/Lib/ftplib.py
@@ -71,6 +71,7 @@
# 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 @@
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()