summaryrefslogtreecommitdiffstats
path: root/Demo/sockets
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-01-12 12:42:09 (GMT)
committerGuido van Rossum <guido@python.org>1995-01-12 12:42:09 (GMT)
commit4f9181ee0b9ff5d6728a2f1375da4c7ab504c36c (patch)
treec7dde59987d880e0c152a6dbe037a65c6e652cbf /Demo/sockets
parent1134991fb1df67b5d084c7c940d52f605af8de18 (diff)
downloadcpython-4f9181ee0b9ff5d6728a2f1375da4c7ab504c36c.zip
cpython-4f9181ee0b9ff5d6728a2f1375da4c7ab504c36c.tar.gz
cpython-4f9181ee0b9ff5d6728a2f1375da4c7ab504c36c.tar.bz2
improve treatment of multi-line replies, ignore empty lines
Diffstat (limited to 'Demo/sockets')
-rwxr-xr-xDemo/sockets/ftp.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Demo/sockets/ftp.py b/Demo/sockets/ftp.py
index 1b672d3..2d49239 100755
--- a/Demo/sockets/ftp.py
+++ b/Demo/sockets/ftp.py
@@ -114,7 +114,7 @@ def getreply(f):
line = f.readline()
if not line: break # Really an error
print line,
- if line[:3] == code: break
+ if line[:3] == code and line[3:4] != '-': break
return code
@@ -134,7 +134,9 @@ def getdata(r):
#
def getcommand():
try:
- return raw_input('ftp.py> ')
+ while 1:
+ line = raw_input('ftp.py> ')
+ if line: return line
except EOFError:
return ''