Show More
@@ -125,7 +125,8 b' class _gitlfsremote(object):' | |||||
125 | self.ui = ui |
|
125 | self.ui = ui | |
126 | baseurl, authinfo = url.authinfo() |
|
126 | baseurl, authinfo = url.authinfo() | |
127 | self.baseurl = baseurl.rstrip('/') |
|
127 | self.baseurl = baseurl.rstrip('/') | |
128 | self.urlopener = urlmod.opener(ui, authinfo) |
|
128 | useragent = 'mercurial/%s git/2.15.1' % util.version() | |
|
129 | self.urlopener = urlmod.opener(ui, authinfo, useragent) | |||
129 | self.retry = ui.configint('lfs', 'retry') |
|
130 | self.retry = ui.configint('lfs', 'retry') | |
130 |
|
131 | |||
131 | def writebatch(self, pointers, fromstore): |
|
132 | def writebatch(self, pointers, fromstore): |
@@ -466,7 +466,7 b' class cookiehandler(urlreq.basehandler):' | |||||
466 |
|
466 | |||
467 | handlerfuncs = [] |
|
467 | handlerfuncs = [] | |
468 |
|
468 | |||
469 | def opener(ui, authinfo=None): |
|
469 | def opener(ui, authinfo=None, useragent=None): | |
470 | ''' |
|
470 | ''' | |
471 | construct an opener suitable for urllib2 |
|
471 | construct an opener suitable for urllib2 | |
472 | authinfo will be added to the password manager |
|
472 | authinfo will be added to the password manager | |
@@ -512,8 +512,14 b' def opener(ui, authinfo=None):' | |||||
512 | # own distribution name. Since servers should not be using the user |
|
512 | # own distribution name. Since servers should not be using the user | |
513 | # agent string for anything, clients should be able to define whatever |
|
513 | # agent string for anything, clients should be able to define whatever | |
514 | # user agent they deem appropriate. |
|
514 | # user agent they deem appropriate. | |
515 | agent = 'mercurial/proto-1.0 (Mercurial %s)' % util.version() |
|
515 | # | |
516 | opener.addheaders = [(r'User-agent', pycompat.sysstr(agent))] |
|
516 | # The custom user agent is for lfs, because unfortunately some servers | |
|
517 | # do look at this value. | |||
|
518 | if not useragent: | |||
|
519 | agent = 'mercurial/proto-1.0 (Mercurial %s)' % util.version() | |||
|
520 | opener.addheaders = [(r'User-agent', pycompat.sysstr(agent))] | |||
|
521 | else: | |||
|
522 | opener.addheaders = [(r'User-agent', pycompat.sysstr(useragent))] | |||
517 |
|
523 | |||
518 | # This header should only be needed by wire protocol requests. But it has |
|
524 | # This header should only be needed by wire protocol requests. But it has | |
519 | # been sent on all requests since forever. We keep sending it for backwards |
|
525 | # been sent on all requests since forever. We keep sending it for backwards |
General Comments 0
You need to be logged in to leave comments.
Login now