statichttprepo: use str to appease Python 3
authorGregory Szorc <gregory.szorc@gmail.com>
Sat, 26 Jan 2019 10:57:17 -0800
changeset 41429 6e9bebb65ce7
parent 41428 2bf689b13a17
child 41430 a43acfa2b76d
statichttprepo: use str to appease Python 3 The URL fed into urllib and HTTP headers need to be str on Python 3. Differential Revision: https://phab.mercurial-scm.org/D5716
mercurial/statichttprepo.py
--- a/mercurial/statichttprepo.py	Sat Jan 26 10:53:10 2019 -0800
+++ b/mercurial/statichttprepo.py	Sat Jan 26 10:57:17 2019 -0800
@@ -19,6 +19,7 @@
     manifest,
     namespaces,
     pathutil,
+    pycompat,
     url,
     util,
     vfs as vfsmod,
@@ -44,12 +45,12 @@
     def seek(self, pos):
         self.pos = pos
     def read(self, bytes=None):
-        req = urlreq.request(self.url)
+        req = urlreq.request(pycompat.strurl(self.url))
         end = ''
         if bytes:
             end = self.pos + bytes - 1
         if self.pos or end:
-            req.add_header('Range', 'bytes=%d-%s' % (self.pos, end))
+            req.add_header(r'Range', r'bytes=%d-%s' % (self.pos, end))
 
         try:
             f = self.opener.open(req)