Patchwork D889: url: use native strings for header values

login
register
mail settings
Submitter phabricator
Date Oct. 2, 2017, 4:21 p.m.
Message ID <52ef1ab33f8c4992f4053dc89c51b8fd@localhost.localdomain>
Download mbox | patch
Permalink /patch/24400/
State Not Applicable
Headers show

Comments

phabricator - Oct. 2, 2017, 4:21 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG0ee9cf8d054a: url: use native strings for header values (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D889?vs=2301&id=2336

REVISION DETAIL
  https://phab.mercurial-scm.org/D889

AFFECTED FILES
  mercurial/url.py

CHANGE DETAILS




To: durin42, #hg-reviewers, yuja
Cc: mercurial-devel

Patch

diff --git a/mercurial/url.py b/mercurial/url.py
--- a/mercurial/url.py
+++ b/mercurial/url.py
@@ -19,6 +19,7 @@ 
     error,
     httpconnection as httpconnectionmod,
     keepalive,
+    pycompat,
     sslutil,
     util,
 )
@@ -495,13 +496,13 @@ 
     # agent string for anything, clients should be able to define whatever
     # user agent they deem appropriate.
     agent = 'mercurial/proto-1.0 (Mercurial %s)' % util.version()
-    opener.addheaders = [('User-agent', agent)]
+    opener.addheaders = [(r'User-agent', pycompat.sysstr(agent))]
 
     # This header should only be needed by wire protocol requests. But it has
     # been sent on all requests since forever. We keep sending it for backwards
     # compatibility reasons. Modern versions of the wire protocol use
     # X-HgProto-<N> for advertising client support.
-    opener.addheaders.append(('Accept', 'application/mercurial-0.1'))
+    opener.addheaders.append((r'Accept', r'application/mercurial-0.1'))
     return opener
 
 def open(ui, url_, data=None):