mercurial/httprepo.py
changeset 4132 0d94e4a3ddb4
parent 4025 d8b3edf88af0
child 4134 9dc64c8414ca
child 4226 fffacca46f09
--- a/mercurial/httprepo.py	Tue Feb 20 22:20:16 2007 +0100
+++ b/mercurial/httprepo.py	Mon Feb 19 12:38:58 2007 +0300
@@ -127,6 +127,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"') %
@@ -141,7 +142,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]
@@ -199,6 +201,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