mercurial/httprepo.py
changeset 4134 9dc64c8414ca
parent 4029 9210fba03d16
parent 4132 0d94e4a3ddb4
child 4232 0d51eb296fb9
--- a/mercurial/httprepo.py	Sat Mar 03 18:59:54 2007 -0800
+++ b/mercurial/httprepo.py	Sun Mar 04 09:03:21 2007 -0300
@@ -126,6 +126,7 @@
     def __init__(self, ui, path):
         self.path = path
         self.caps = None
+        self.handler = None
         scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path)
         if query or frag:
             raise util.Abort(_('unsupported URL component: "%s"') %
@@ -140,7 +141,8 @@
 
         proxyurl = ui.config("http_proxy", "host") or os.getenv('http_proxy')
         # XXX proxyauthinfo = None
-        handlers = [httphandler()]
+        self.handler = httphandler()
+        handlers = [self.handler]
 
         if proxyurl:
             # proxy can be proper url or host[:port]
@@ -198,6 +200,11 @@
         # 1.0 here is the _protocol_ version
         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