# HG changeset patch # User Senthil Kumaran # Date 1370100426 25200 # Node ID dbfbdf2b5c19cb019623ada3d499353896cbd9d4 # Parent 81c02d2c830d83a4aaece35503d428af1af2a59b Fix #17967: For ftp urls CWD to target instead of hopping to each directory towards target. This fixes a bug where target is accessible, but parent directories are restricted. diff -r 81c02d2c830d -r dbfbdf2b5c19 Lib/urllib/request.py --- a/Lib/urllib/request.py Fri May 31 22:31:02 2013 +0300 +++ b/Lib/urllib/request.py Sat Jun 01 08:27:06 2013 -0700 @@ -2273,8 +2273,7 @@ self.ftp = ftplib.FTP() self.ftp.connect(self.host, self.port, self.timeout) self.ftp.login(self.user, self.passwd) - for dir in self.dirs: - self.ftp.cwd(dir) + self.ftp.cwd(os.path.join(*self.dirs)) def retrfile(self, file, type): import ftplib