diff options
author | Giampaolo RodolĂ <g.rodola@gmail.com> | 2010-08-23 22:10:32 (GMT) |
---|---|---|
committer | Giampaolo RodolĂ <g.rodola@gmail.com> | 2010-08-23 22:10:32 (GMT) |
commit | bbc4782d77ac76e317182fb2400c6b7e1c305bdd (patch) | |
tree | fa7af8dead271eb695e12e70a7a9be79009085bc /Lib/ftplib.py | |
parent | 076e031e54bd8d50b1d54083c86c7c6d53eed6bb (diff) | |
download | cpython-bbc4782d77ac76e317182fb2400c6b7e1c305bdd.zip cpython-bbc4782d77ac76e317182fb2400c6b7e1c305bdd.tar.gz cpython-bbc4782d77ac76e317182fb2400c6b7e1c305bdd.tar.bz2 |
fix issue 9601: ftplib now provides a workaround for invalid response code returned on MKD and PWD by non-compliant FTPserver implementations such as ISS shipped with Windows server 2003
Diffstat (limited to 'Lib/ftplib.py')
-rw-r--r-- | Lib/ftplib.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/ftplib.py b/Lib/ftplib.py index 8a097c0..ef69ca6 100644 --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -565,7 +565,11 @@ class FTP: def mkd(self, dirname): '''Make a directory, return its full pathname.''' - resp = self.sendcmd('MKD ' + dirname) + resp = self.voidcmd('MKD ' + dirname) + # fix around non-compliant implementations such as IIS shipped + # with Windows server 2003 + if not resp.startswith('257'): + return '' return parse257(resp) def rmd(self, dirname): @@ -574,7 +578,11 @@ class FTP: def pwd(self): '''Return current working directory.''' - resp = self.sendcmd('PWD') + resp = self.voidcmd('PWD') + # fix around non-compliant implementations such as IIS shipped + # with Windows server 2003 + if not resp.startswith('257'): + return '' return parse257(resp) def quit(self): |