Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/request.py @ 37606:da84e26d85ed
hgweb: use our forked wsgiheaders module instead of stdlib one
Now we use bytes for headers, rather than native strings.
Differential Revision: https://phab.mercurial-scm.org/D2854
author | Augie Fackler <augie@google.com> |
---|---|
date | Wed, 11 Apr 2018 14:01:37 -0400 |
parents | e320d9405bba |
children | 5e81cf9651c1 |
comparison
equal
deleted
inserted
replaced
37605:74e1362585c0 | 37606:da84e26d85ed |
---|---|
6 # This software may be used and distributed according to the terms of the | 6 # This software may be used and distributed according to the terms of the |
7 # GNU General Public License version 2 or any later version. | 7 # GNU General Public License version 2 or any later version. |
8 | 8 |
9 from __future__ import absolute_import | 9 from __future__ import absolute_import |
10 | 10 |
11 import wsgiref.headers as wsgiheaders | |
12 #import wsgiref.validate | 11 #import wsgiref.validate |
13 | 12 |
14 from ..thirdparty import ( | 13 from ..thirdparty import ( |
15 attr, | 14 attr, |
16 ) | 15 ) |
287 headers = [] | 286 headers = [] |
288 for k, v in env.iteritems(): | 287 for k, v in env.iteritems(): |
289 if k.startswith('HTTP_'): | 288 if k.startswith('HTTP_'): |
290 headers.append((k[len('HTTP_'):].replace('_', '-'), v)) | 289 headers.append((k[len('HTTP_'):].replace('_', '-'), v)) |
291 | 290 |
291 from . import wsgiheaders # avoid cycle | |
292 headers = wsgiheaders.Headers(headers) | 292 headers = wsgiheaders.Headers(headers) |
293 | 293 |
294 # This is kind of a lie because the HTTP header wasn't explicitly | 294 # This is kind of a lie because the HTTP header wasn't explicitly |
295 # sent. But for all intents and purposes it should be OK to lie about | 295 # sent. But for all intents and purposes it should be OK to lie about |
296 # this, since a consumer will either either value to determine how many | 296 # this, since a consumer will either either value to determine how many |
376 """ | 376 """ |
377 self._req = req | 377 self._req = req |
378 self._startresponse = startresponse | 378 self._startresponse = startresponse |
379 | 379 |
380 self.status = None | 380 self.status = None |
381 from . import wsgiheaders # avoid cycle | |
381 self.headers = wsgiheaders.Headers([]) | 382 self.headers = wsgiheaders.Headers([]) |
382 | 383 |
383 self._bodybytes = None | 384 self._bodybytes = None |
384 self._bodygen = None | 385 self._bodygen = None |
385 self._bodywillwrite = False | 386 self._bodywillwrite = False |