503 handlers.extend((httpbasicauthhandler(passmgr), |
503 handlers.extend((httpbasicauthhandler(passmgr), |
504 httpdigestauthhandler(passmgr))) |
504 httpdigestauthhandler(passmgr))) |
505 handlers.extend([h(ui, passmgr) for h in handlerfuncs]) |
505 handlers.extend([h(ui, passmgr) for h in handlerfuncs]) |
506 opener = urlreq.buildopener(*handlers) |
506 opener = urlreq.buildopener(*handlers) |
507 |
507 |
508 # 1.0 here is the _protocol_ version |
508 # The user agent should should *NOT* be used by servers for e.g. |
509 opener.addheaders = [('User-agent', 'mercurial/proto-1.0')] |
509 # protocol detection or feature negotiation: there are other |
|
510 # facilities for that. |
|
511 # |
|
512 # "mercurial/proto-1.0" was the original user agent string and |
|
513 # exists for backwards compatibility reasons. |
|
514 # |
|
515 # The "(Mercurial %s)" string contains the distribution |
|
516 # name and version. Other client implementations should choose their |
|
517 # own distribution name. Since servers should not be using the user |
|
518 # agent string for anything, clients should be able to define whatever |
|
519 # user agent they deem appropriate. |
|
520 agent = 'mercurial/proto-1.0 (Mercurial %s)' % util.version() |
|
521 opener.addheaders = [('User-agent', agent)] |
510 opener.addheaders.append(('Accept', 'application/mercurial-0.1')) |
522 opener.addheaders.append(('Accept', 'application/mercurial-0.1')) |
511 return opener |
523 return opener |
512 |
524 |
513 def open(ui, url_, data=None): |
525 def open(ui, url_, data=None): |
514 u = util.url(url_) |
526 u = util.url(url_) |