D2854: hgweb: str/bytes followups after indygreg's refactoring
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Wed Mar 14 10:56:43 EDT 2018
indygreg added a comment.
In https://phab.mercurial-scm.org/D2854#45911, @indygreg wrote:
> parsedrequest.headers is supposed to be bytes. One of the goals of this refactor was to make the WSGI code all bytes all the time. So if system strings are making their way to the new request or response objects (i.e. outside request.py), then something is wrong and we should fix that: we shouldn’t need to introduce raw literals outside of the very low level WSGI code.
We're using `wsgirequest.headers.Headers`. Python 3's implementation insists that headers be specified as the native `str` type: https://github.com/python/cpython/blob/master/Lib/wsgiref/headers.py. Because of course it does. Ugh.
It looks like we'll have to implement a case insensitive + `-`/`_` normalizing keys dict for header storage. Shouldn't be a big deal.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D2854
To: durin42, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel
More information about the Mercurial-devel
mailing list