py3: use str variables to check keys in request header
authorPulkit Goyal <7895pulkit@gmail.com>
Sat, 14 Apr 2018 02:02:11 +0530
changeset 37665 83250442dc81
parent 37664 483cafc3762a
child 37666 46e705b79323
py3: use str variables to check keys in request header The values in header are of str type. Differential Revision: https://phab.mercurial-scm.org/D3326
mercurial/keepalive.py
--- a/mercurial/keepalive.py	Sat Apr 14 02:00:43 2018 +0530
+++ b/mercurial/keepalive.py	Sat Apr 14 02:02:11 2018 +0530
@@ -318,15 +318,15 @@
         headers.update(sorted(req.unredirected_hdrs.items()))
         headers = util.sortdict((n.lower(), v) for n, v in headers.items())
         skipheaders = {}
-        for n in ('host', 'accept-encoding'):
+        for n in (r'host', r'accept-encoding'):
             if n in headers:
-                skipheaders['skip_' + n.replace('-', '_')] = 1
+                skipheaders[r'skip_' + n.replace(r'-', r'_')] = 1
         try:
             if urllibcompat.hasdata(req):
                 data = urllibcompat.getdata(req)
                 h.putrequest(
                     req.get_method(), urllibcompat.getselector(req),
-                    **pycompat.strkwargs(skipheaders))
+                    skipheaders)
                 if r'content-type' not in headers:
                     h.putheader(r'Content-type',
                                 r'application/x-www-form-urlencoded')
@@ -335,7 +335,7 @@
             else:
                 h.putrequest(
                     req.get_method(), urllibcompat.getselector(req),
-                    **pycompat.strkwargs(skipheaders))
+                    skipheaders)
         except socket.error as err:
             raise urlerr.urlerror(err)
         for k, v in headers.items():