Patchwork D1108: hgweb: more "http headers are native strs" cleanup

login
register
mail settings
Submitter phabricator
Date Oct. 16, 2017, 3:10 p.m.
Message ID <fdb47e9d25031fe84eee1a7e5d577ad6@localhost.localdomain>
Download mbox | patch
Permalink /patch/24994/
State Not Applicable
Headers show

Comments

phabricator - Oct. 16, 2017, 3:10 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb2601c5977a4: hgweb: more &quot;http headers are native strs&quot; cleanup (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1108?vs=2810&id=2816

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

AFFECTED FILES
  mercurial/hgweb/hgweb_mod.py
  mercurial/hgweb/protocol.py
  mercurial/hgweb/server.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py
--- a/mercurial/hgweb/server.py
+++ b/mercurial/hgweb/server.py
@@ -194,9 +194,9 @@ 
             self._chunked = (not self.close_connection and
                              self.request_version == "HTTP/1.1")
             if self._chunked:
-                self.send_header('Transfer-Encoding', 'chunked')
+                self.send_header(r'Transfer-Encoding', r'chunked')
             else:
-                self.send_header('Connection', 'close')
+                self.send_header(r'Connection', r'close')
         self.end_headers()
         self.sent_headers = True
 
diff --git a/mercurial/hgweb/protocol.py b/mercurial/hgweb/protocol.py
--- a/mercurial/hgweb/protocol.py
+++ b/mercurial/hgweb/protocol.py
@@ -75,10 +75,10 @@ 
         args.update(cgi.parse_qs(argvalue, keep_blank_values=True))
         return args
     def getfile(self, fp):
-        length = int(self.req.env['CONTENT_LENGTH'])
+        length = int(self.req.env[r'CONTENT_LENGTH'])
         # If httppostargs is used, we need to read Content-Length
         # minus the amount that was consumed by args.
-        length -= int(self.req.env.get('HTTP_X_HGARGS_POST', 0))
+        length -= int(self.req.env.get(r'HTTP_X_HGARGS_POST', 0))
         for s in util.filechunkiter(self.req, limit=length):
             fp.write(s)
     def redirect(self):
diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -378,7 +378,7 @@ 
                     req.env.get('X-HgHttp2', '')):
                     req.drain()
                 else:
-                    req.headers.append(('Connection', 'Close'))
+                    req.headers.append((r'Connection', r'Close'))
                 req.respond(inst, protocol.HGTYPE,
                             body='0\n%s\n' % inst)
                 return ''