mercurial/httprepo.py
changeset 5982 b6bd4ee6ed85
parent 5526 d5b9c74c910e
child 5983 6f1fcbc58efa
--- a/mercurial/httprepo.py	Sun Feb 03 21:03:46 2008 -0200
+++ b/mercurial/httprepo.py	Sun Feb 03 21:03:46 2008 -0200
@@ -107,6 +107,9 @@
     def http_open(self, req):
         return self.do_open(httpconnection, req)
 
+    def __del__(self):
+        self.close_all()
+
 has_https = hasattr(urllib2, 'HTTPSHandler')
 if has_https:
     class httpsconnection(httplib.HTTPSConnection):
@@ -203,8 +206,7 @@
 
         proxyurl = ui.config("http_proxy", "host") or os.getenv('http_proxy')
         # XXX proxyauthinfo = None
-        self.handler = httphandler()
-        handlers = [self.handler]
+        handlers = [httphandler()]
 
         if proxyurl:
             # proxy can be proper url or host[:port]
@@ -270,11 +272,6 @@
         opener.addheaders = [('User-agent', 'mercurial/proto-1.0')]
         urllib2.install_opener(opener)
 
-    def __del__(self):
-        if self.handler:
-            self.handler.close_all()
-            self.handler = None
-
     def url(self):
         return self.path