Oleg Broytmann phd at phd.russ.ru
Sat May 20 14:29:00 CEST 2000


   Thanks! I'll test it and report sometime next week.

On Sat, 20 May 2000, Guido van Rossum wrote:
> Oleg Broytmann <phd at phd.russ.ru> writes:
> > 
> > fname, headers = urllib.urlretrieve("ftp://starship.python.net/")
> > 
> >    and it hangs :( Almost all FTP URLs will hang

> I played with this a bit and found that ftp.python.org works but
> starship.python.net hangs...  Then I had a sudden idea: maybe these
> ftp daemons only send the 226 message once the data socket has been
> closed!
> The following change works for me: in urllib.py, class addclosehook,
> method close(), move the call addbase.close(self) to the top of the
> method, so the data socket gets closed before the hook (which waits
> for the 226 code on the control socket) is called.
>     def close(self):
>         addbase.close(self)
>         if self.closehook:
>             apply(self.closehook, self.hookargs)
>             self.closehook = None
>             self.hookargs = None
> Let me know if this fixes your problem (with no other changes to
> urllib).

Oleg.            (All opinions are mine and not of my employer)
    Oleg Broytmann      Foundation for Effective Policies      phd at phd.russ.ru
           Programmers don't die, they just GOSUB without RETURN.

More information about the Python-list mailing list