[Python-checkins] r52740 - in python/branches/release25-maint: Lib/ftplib.py Misc/NEWS

martin.v.loewis python-checkins at python.org
Sun Nov 12 19:48:30 CET 2006


Author: martin.v.loewis
Date: Sun Nov 12 19:48:30 2006
New Revision: 52740

Modified:
   python/branches/release25-maint/Lib/ftplib.py
   python/branches/release25-maint/Misc/NEWS
Log:
Patch #1359217: Ignore 2xx response before 150 response.


Modified: python/branches/release25-maint/Lib/ftplib.py
==============================================================================
--- python/branches/release25-maint/Lib/ftplib.py	(original)
+++ python/branches/release25-maint/Lib/ftplib.py	Sun Nov 12 19:48:30 2006
@@ -325,6 +325,14 @@
             if rest is not None:
                 self.sendcmd("REST %s" % rest)
             resp = self.sendcmd(cmd)
+            # Some servers apparently send a 200 reply to
+            # a LIST or STOR command, before the 150 reply
+            # (and way before the 226 reply). This seems to
+            # be in violation of the protocol (which only allows
+            # 1xx or error messages for LIST), so we just discard
+            # this response.
+            if resp[0] == '2':
+               resp = self.getresp()
             if resp[0] != '1':
                 raise error_reply, resp
         else:
@@ -332,6 +340,9 @@
             if rest is not None:
                 self.sendcmd("REST %s" % rest)
             resp = self.sendcmd(cmd)
+            # See above.
+            if resp[0] == '2':
+               resp = self.getresp()
             if resp[0] != '1':
                 raise error_reply, resp
             conn, sockaddr = sock.accept()

Modified: python/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS	(original)
+++ python/branches/release25-maint/Misc/NEWS	Sun Nov 12 19:48:30 2006
@@ -99,6 +99,9 @@
 Library
 -------
 
+- Patch #1359217: Process 2xx response in an ftplib transfer
+  that precedes an 1xx response.
+
 - Patch #1060577: Extract list of RPM files from spec file in
   bdist_rpm
 


More information about the Python-checkins mailing list