# HG changeset patch # User Andrei Vermel # Date 1171877938 -10800 # Node ID 0d94e4a3ddb498dc58dec6f38a48c86047ddd733 # Parent 1ca664c964e0003ce99f6550aeeeed4ccf76851d Close keepalive connections to fix server traceback diff --git a/mercurial/httprepo.py b/mercurial/httprepo.py --- a/mercurial/httprepo.py +++ b/mercurial/httprepo.py @@ -127,6 +127,7 @@ class httprepository(remoterepository): 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 @@ class httprepository(remoterepository): 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 @@ class httprepository(remoterepository): # 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