# HG changeset patch # User Augie Fackler # Date 1523478400 14400 # Node ID b5ca5d34fe8da7c2b41d8651edb216e35e4ff32c # Parent 9170df9106a8befb38abfc906ae1ac58e8e4e19f hgweb: use native strings when interfacing with stdlib headers We're still parsing the stdlib-provided headers here, so we need to tread carefully and use native strings. Yuck. Differential Revision: https://phab.mercurial-scm.org/D3250 diff -r 9170df9106a8 -r b5ca5d34fe8d mercurial/hgweb/server.py --- a/mercurial/hgweb/server.py Wed Apr 11 16:10:02 2018 -0400 +++ b/mercurial/hgweb/server.py Wed Apr 11 16:26:40 2018 -0400 @@ -139,17 +139,17 @@ env[r'CONTENT_TYPE'] = self.headers.get_default_type() else: env[r'CONTENT_TYPE'] = self.headers.get_content_type() - length = self.headers.get('content-length') + length = self.headers.get(r'content-length') else: if self.headers.typeheader is None: env[r'CONTENT_TYPE'] = self.headers.type else: env[r'CONTENT_TYPE'] = self.headers.typeheader - length = self.headers.getheader('content-length') + length = self.headers.getheader(r'content-length') if length: env[r'CONTENT_LENGTH'] = length for header in [h for h in self.headers.keys() - if h not in ('content-type', 'content-length')]: + if h not in (r'content-type', r'content-length')]: hkey = r'HTTP_' + header.replace(r'-', r'_').upper() hval = self.headers.get(header) hval = hval.replace(r'\n', r'').strip()