Patchwork D887: httppeer: use native strings for headers

login
register
mail settings
Submitter phabricator
Date Oct. 14, 2017, 6:52 a.m.
Message ID <746915cbafa83a9ecef587765ecdc027@localhost.localdomain>
Download mbox | patch
Permalink /patch/24878/
State Not Applicable
Headers show

Comments

phabricator - Oct. 14, 2017, 6:52 a.m.
durin42 updated this revision to Diff 2720.
durin42 marked 2 inline comments as done.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D887?vs=2299&id=2720

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

AFFECTED FILES
  mercurial/httppeer.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
--- a/mercurial/httppeer.py
+++ b/mercurial/httppeer.py
@@ -221,7 +221,7 @@ 
                 argsio = io.BytesIO(strargs)
                 argsio.length = len(strargs)
                 data = _multifile(argsio, data)
-            headers['X-HgArgs-Post'] = len(strargs)
+            headers[r'X-HgArgs-Post'] = len(strargs)
         else:
             if len(args) > 0:
                 httpheader = self.capable('httpheader')
@@ -237,17 +237,17 @@ 
             else:
                 q += sorted(args.items())
         qs = '?%s' % urlreq.urlencode(q)
-        cu = "%s%s" % (self._url, qs)
+        cu = r"%s%s" % (pycompat.strurl(self._url), qs)
         size = 0
         if util.safehasattr(data, 'length'):
             size = data.length
         elif data is not None:
             size = len(data)
         if size and self.ui.configbool('ui', 'usehttp2'):
-            headers['Expect'] = '100-Continue'
-            headers['X-HgHttp2'] = '1'
-        if data is not None and 'Content-Type' not in headers:
-            headers['Content-Type'] = 'application/mercurial-0.1'
+            headers[r'Expect'] = r'100-Continue'
+            headers[r'X-HgHttp2'] = r'1'
+        if data is not None and r'Content-Type' not in headers:
+            headers[r'Content-Type'] = r'application/mercurial-0.1'
 
         # Tell the server we accept application/mercurial-0.2 and multiple
         # compression formats if the server is capable of emitting those
@@ -281,7 +281,7 @@ 
                 varyheaders.append(header)
 
         if varyheaders:
-            headers['Vary'] = ','.join(varyheaders)
+            headers[r'Vary'] = r','.join(varyheaders)
 
         req = self._requestbuilder(cu, data, headers)