Mercurial > hg
comparison mercurial/httprepo.py @ 6285:4b81eecc8aa2
Change User-agent field in client to have a lot more info.
author | Eric Hopper <hopper@omnifarious.org> |
---|---|
date | Sat, 15 Mar 2008 12:42:41 -0700 |
parents | e75aab656f46 |
children | 91ac1726730a 9c195637ac0b |
comparison
equal
deleted
inserted
replaced
6284:c93b6c0e6e84 | 6285:4b81eecc8aa2 |
---|---|
8 | 8 |
9 from node import bin, hex | 9 from node import bin, hex |
10 from remoterepo import remoterepository | 10 from remoterepo import remoterepository |
11 from i18n import _ | 11 from i18n import _ |
12 import repo, os, urllib, urllib2, urlparse, zlib, util, httplib | 12 import repo, os, urllib, urllib2, urlparse, zlib, util, httplib |
13 import errno, keepalive, socket, changegroup | 13 import errno, keepalive, socket, changegroup, version |
14 | 14 |
15 class passwordmgr(urllib2.HTTPPasswordMgrWithDefaultRealm): | 15 class passwordmgr(urllib2.HTTPPasswordMgrWithDefaultRealm): |
16 def __init__(self, ui): | 16 def __init__(self, ui): |
17 urllib2.HTTPPasswordMgrWithDefaultRealm.__init__(self) | 17 urllib2.HTTPPasswordMgrWithDefaultRealm.__init__(self) |
18 self.ui = ui | 18 self.ui = ui |
266 handlers.extend((urllib2.HTTPBasicAuthHandler(passmgr), | 266 handlers.extend((urllib2.HTTPBasicAuthHandler(passmgr), |
267 httpdigestauthhandler(passmgr))) | 267 httpdigestauthhandler(passmgr))) |
268 opener = urllib2.build_opener(*handlers) | 268 opener = urllib2.build_opener(*handlers) |
269 | 269 |
270 # 1.0 here is the _protocol_ version | 270 # 1.0 here is the _protocol_ version |
271 opener.addheaders = [('User-agent', 'mercurial/proto-1.0')] | 271 opener.addheaders = [('User-agent', version.get_useragent())] |
272 urllib2.install_opener(opener) | 272 urllib2.install_opener(opener) |
273 | 273 |
274 def url(self): | 274 def url(self): |
275 return self.path | 275 return self.path |
276 | 276 |