urllib/ftpwrapper

Oleg Broytmann phd at phd.russ.ru
Tue May 23 05:27:09 EDT 2000


Hello!

   Yes, this fixed the problem! What's more, this fixed other problem - in
my database of monitored URLs there are some FTP URLs, that didn't hang
urllib, but returned 'ftp error'.
   With your patch for urllib the error was no more. Last night I ran the
robot, and got no one hang or error (I've got other errors, but they are
certainly not related here - random timeouts, DNS problems, etc - usual
bunch of Internet problems :).
   I hope to see the patch in 1.6. Thank you very much!

On Sat, 20 May 2000, Guido van Rossum wrote:
> 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