[Python-checkins] CVS: python/dist/src/Lib urllib.py,1.93,1.94

Guido van Rossum python-dev@python.org
Wed, 24 May 2000 06:21:49 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv8188

Modified Files:
	urllib.py 
Log Message:
Fix a problem reported by Oleg Broytmann, who complains that very
often, ftp URLs hang in the final close.  Further analysis suggests
that this is because the close hook in addclosehook() calls the hook
before acually closing the connection.  The hook, in this case, waits
for the '226 Transfer complete' status from the server on the command
socket.  However, more and more ftp servers only send this status when
the data socket has actually been closed -- causing a deadlock.

The fix is simple: in addclosehook.close(), call addbase.close()
*before* calling the closehook.


Index: urllib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v
retrieving revision 1.93
retrieving revision 1.94
diff -C2 -r1.93 -r1.94
*** urllib.py	2000/04/24 14:17:06	1.93
--- urllib.py	2000/05/24 13:21:46	1.94
***************
*** 727,735 ****
  
      def close(self):
          if self.closehook:
              apply(self.closehook, self.hookargs)
              self.closehook = None
              self.hookargs = None
-         addbase.close(self)
  
  class addinfo(addbase):
--- 727,735 ----
  
      def close(self):
+         addbase.close(self)
          if self.closehook:
              apply(self.closehook, self.hookargs)
              self.closehook = None
              self.hookargs = None
  
  class addinfo(addbase):