Mercurial > hg-stable
changeset 39956:c421c22d3ad2
py3: convert HTTP request headers to str
The low-level request object ideally takes system strings for
HTTP request headers and values. If we send in bytes, it works. But
a duplicate header check fails and various tests emit duplicate
user-agent headers.
Differential Revision: https://phab.mercurial-scm.org/D4834
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 01 Oct 2018 23:08:04 -0700 |
parents | 8c7ecd32ccce |
children | 36e9d2c60837 |
files | mercurial/debugcommands.py |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/debugcommands.py Mon Oct 01 23:12:42 2018 -0700 +++ b/mercurial/debugcommands.py Mon Oct 01 23:08:04 2018 -0700 @@ -3286,7 +3286,10 @@ line = line.lstrip() m = re.match(b'^([a-zA-Z0-9_-]+): (.*)$', line) if m: - headers[m.group(1)] = m.group(2) + # Headers need to use native strings. + key = pycompat.strurl(m.group(1)) + value = pycompat.strurl(m.group(2)) + headers[key] = value continue if line.startswith(b'BODYFILE '):