# HG changeset patch # User Gregory Szorc # Date 2018-10-02 06:08:04 # Node ID c421c22d3ad28ea13b2973d238ff03df2622a1e7 # Parent 8c7ecd32ccceb2f277e7e3bcbdf4856f2e7a27ac 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 diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -3286,7 +3286,10 @@ def debugwireproto(ui, repo, path=None, 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 '):