Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit be17a11

Browse files
committed
Merged revisions 66634 via svnmerge from
svn+ssh://[email protected]/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.) ........
1 parent f2e9368 commit be17a11

2 files changed

Lines changed: 434 additions & 39 deletions

File tree

Lib/ftplib.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class error_proto(Error): pass # response does not begin with [1-5]
7171

7272
# Line terminators (we always output CRLF, but accept any of CRLF, CR, LF)
7373
CRLF = '\r\n'
74+
B_CRLF = b'\r\n'
7475

7576
# The class itself
7677
class FTP:
@@ -472,9 +473,9 @@ def storlines(self, cmd, fp, callback=None):
472473
while 1:
473474
buf = fp.readline()
474475
if not buf: break
475-
if buf[-2:] != CRLF:
476-
if buf[-1] in CRLF: buf = buf[:-1]
477-
buf = buf + CRLF
476+
if buf[-2:] != B_CRLF:
477+
if buf[-1] in B_CRLF: buf = buf[:-1]
478+
buf = buf + B_CRLF
478479
conn.sendall(buf)
479480
if callback: callback(buf)
480481
conn.close()

0 commit comments

Comments
 (0)