[Python-bugs-list] [ python-Bugs-495693 ] urllib doesn't support passive FTP
noreply@sourceforge.net
noreply@sourceforge.net
Sun, 23 Dec 2001 05:56:20 -0800
Bugs item #495693, was opened at 2001-12-20 16:51
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=495693&group_id=5470
Category: Python Library
>Group: Python 2.2.1 candidate
Status: Open
Resolution: None
Priority: 5
Submitted By: Matthias Klose (doko)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib doesn't support passive FTP
Initial Comment:
[please CC 40981@bugs.debian.org on replies; complete
report can be found at http://bugs.debian.org/40981]
urllib.urlopen/urlretrieve doesn't support passive FTP
urllib doesn't support passive FTP, even though the
underlying ftplib
module does. I dunno what the right approach is
(perhaps a urllib
module global variable). I know some tools (I'm aware
of at least
ncftp and wget) autodetect whether PASV is supported
by FTP servers;
perhaps that intelligence could be added to ftplib.
(Also: the FTP class's set_pasv() method isn't
documented in my
version of python-docs; I haven't checked the new
1.5.2 docs yet
however.)
At the moment, I'm using this ugly hack to get around
it:
# Really ugly hack; don't try this at home:
def ftpwrapper_init(self):
import ftplib
self.busy = 0
self.ftp = ftplib.FTP()
self.ftp.set_pasv(1)
self.ftp.connect(self.host, self.port)
self.ftp.login(self.user, self.passwd)
for dir in self.dirs:
self.ftp.cwd(dir)
urllib.ftpwrapper.init = ftpwrapper_init
# End really ugly hack
----------------------------------------------------------------------
>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-23 05:56
Message:
Logged In: YES
user_id=6380
Right now I have this listed as a bug, with fix, in
python.org/2.2/bugs.html. When we get more, I agree that
MoinMoin would be a good idea.
I've checked in the fix on the trunk. This is definitely a
2.2.1 release candidate.
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2001-12-23 03:16
Message:
Logged In: YES
user_id=21627
Yes, that is quite unfortunate, and an error. In itojun's
original patch, there was still self.passiveserver=0 in the
context (it was against 1.46). That patch did not apply
after your changes (in 1.48 and 1.52) anymore, so I asked
him to regenerate the patches, but neither of us noticed
that particular change.
I'll attach the obvious change below; perhaps we should
revive the MoinMoin pages to distribute hotfixes?
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-22 07:08
Message:
Logged In: YES
user_id=6380
Martin, in ftplib.py, there's a self.passiveserver = 0" in
the connect method that overrides the default "passiveserver
= 1" at the class level. This was introduced in rev. 1.54
when you integrated IPV6 support.
Shouldn't this be taken out? Rev 1.48 announces "default to
passive mode". The IPV6 patch must have broken this.
(I'm sorry I didn't look at this before the release; this is
an unfortunate glitch in 2.2!)
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2001-12-22 06:51
Message:
Logged In: YES
user_id=21627
Is the debian bug number correct? The URL gives
"An error occurred. Dammit. Error was: Couldn't get bug
status: No such file or directory."
Also, CC'ing the Debian BTS is not easy through SF, would it
be feasible that you forward all comments to the BTS yourself?
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=495693&group_id=5470