Mercurial > hg
comparison mercurial/url.py @ 34428:0ee9cf8d054a
url: use native strings for header values
Differential Revision: https://phab.mercurial-scm.org/D889
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 01 Oct 2017 12:16:34 -0400 |
parents | 0407a51b9d8c |
children | 1232f7fa00c3 |
comparison
equal
deleted
inserted
replaced
34427:a454123f5d94 | 34428:0ee9cf8d054a |
---|---|
17 from . import ( | 17 from . import ( |
18 encoding, | 18 encoding, |
19 error, | 19 error, |
20 httpconnection as httpconnectionmod, | 20 httpconnection as httpconnectionmod, |
21 keepalive, | 21 keepalive, |
22 pycompat, | |
22 sslutil, | 23 sslutil, |
23 util, | 24 util, |
24 ) | 25 ) |
25 | 26 |
26 httplib = util.httplib | 27 httplib = util.httplib |
493 # name and version. Other client implementations should choose their | 494 # name and version. Other client implementations should choose their |
494 # own distribution name. Since servers should not be using the user | 495 # own distribution name. Since servers should not be using the user |
495 # agent string for anything, clients should be able to define whatever | 496 # agent string for anything, clients should be able to define whatever |
496 # user agent they deem appropriate. | 497 # user agent they deem appropriate. |
497 agent = 'mercurial/proto-1.0 (Mercurial %s)' % util.version() | 498 agent = 'mercurial/proto-1.0 (Mercurial %s)' % util.version() |
498 opener.addheaders = [('User-agent', agent)] | 499 opener.addheaders = [(r'User-agent', pycompat.sysstr(agent))] |
499 | 500 |
500 # This header should only be needed by wire protocol requests. But it has | 501 # This header should only be needed by wire protocol requests. But it has |
501 # been sent on all requests since forever. We keep sending it for backwards | 502 # been sent on all requests since forever. We keep sending it for backwards |
502 # compatibility reasons. Modern versions of the wire protocol use | 503 # compatibility reasons. Modern versions of the wire protocol use |
503 # X-HgProto-<N> for advertising client support. | 504 # X-HgProto-<N> for advertising client support. |
504 opener.addheaders.append(('Accept', 'application/mercurial-0.1')) | 505 opener.addheaders.append((r'Accept', r'application/mercurial-0.1')) |
505 return opener | 506 return opener |
506 | 507 |
507 def open(ui, url_, data=None): | 508 def open(ui, url_, data=None): |
508 u = util.url(url_) | 509 u = util.url(url_) |
509 if u.scheme: | 510 if u.scheme: |