summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-01-19 22:26:54 (GMT)
committerGuido van Rossum <guido@python.org>1998-01-19 22:26:54 (GMT)
commite7579624ef2997783f5f5354b3fcf8b0ceccabd2 (patch)
tree565509d16b1b318b4db34a5069b7c7c21ab8466f
parentca99c2ce75ec3b64fa483e800c6739a7851b468d (diff)
downloadcpython-e7579624ef2997783f5f5354b3fcf8b0ceccabd2.zip
cpython-e7579624ef2997783f5f5354b3fcf8b0ceccabd2.tar.gz
cpython-e7579624ef2997783f5f5354b3fcf8b0ceccabd2.tar.bz2
Fix bad new bug in ftp code -- the test for existing file using NLST
would set the transfer to text mode instead of the specified mode.
-rw-r--r--Lib/urllib.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py
index b9a82d1..8ecef03 100644
--- a/Lib/urllib.py
+++ b/Lib/urllib.py
@@ -521,6 +521,8 @@ class ftpwrapper:
except ftplib.error_perm, reason:
raise IOError, ('ftp error', reason), \
sys.exc_info()[2]
+ # Restore the transfer mode!
+ self.ftp.voidcmd(cmd)
# Try to retrieve as a file
try:
cmd = 'RETR ' + file
@@ -530,6 +532,8 @@ class ftpwrapper:
raise IOError, ('ftp error', reason), \
sys.exc_info()[2]
if not conn:
+ # Set transfer mode to ASCII!
+ self.ftp.voidcmd('TYPE A')
# Try a directory listing
if file: cmd = 'LIST ' + file
else: cmd = 'LIST'