Now we use bytes for headers, rather than native strings.
Details
- Reviewers
indygreg - Group Reviewers
hg-reviewers - Commits
- rHGda84e26d85ed: hgweb: use our forked wsgiheaders module instead of stdlib one
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
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.
This one caused an import cycle: Import cycle: mercurial.hgweb.__init__ -> mercurial.hgweb.hgweb_mod -> mercurial.hgweb.request -> mercurial.hgweb.__init__