comparison mercurial/hgweb/hgweb_mod.py @ 36881:96a93625a824

hgweb: stop setting headers on wsgirequest All commands now go through the new response API. This is dead code. Differential Revision: https://phab.mercurial-scm.org/D2797
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 10 Mar 2018 19:08:58 -0800
parents 67fb0dca29bc
children 061635d4221c
comparison
equal deleted inserted replaced
36880:67fb0dca29bc 36881:96a93625a824
311 rctx.repo.ui.environ = wsgireq.env 311 rctx.repo.ui.environ = wsgireq.env
312 312
313 if rctx.csp: 313 if rctx.csp:
314 # hgwebdir may have added CSP header. Since we generate our own, 314 # hgwebdir may have added CSP header. Since we generate our own,
315 # replace it. 315 # replace it.
316 wsgireq.headers = [h for h in wsgireq.headers
317 if h[0] != 'Content-Security-Policy']
318 wsgireq.headers.append(('Content-Security-Policy', rctx.csp))
319 res.headers['Content-Security-Policy'] = rctx.csp 316 res.headers['Content-Security-Policy'] = rctx.csp
320 317
321 handled = wireprotoserver.handlewsgirequest( 318 handled = wireprotoserver.handlewsgirequest(
322 rctx, req, res, self.check_perm) 319 rctx, req, res, self.check_perm)
323 if handled: 320 if handled:
391 res.status = '304 Not Modified' 388 res.status = '304 Not Modified'
392 # Response body not allowed on 304. 389 # Response body not allowed on 304.
393 res.setbodybytes('') 390 res.setbodybytes('')
394 return res.sendresponse() 391 return res.sendresponse()
395 392
396 wsgireq.headers.append((r'ETag', pycompat.sysstr(tag)))
397 res.headers['ETag'] = tag 393 res.headers['ETag'] = tag
398 394
399 if cmd not in webcommands.__all__: 395 if cmd not in webcommands.__all__:
400 msg = 'no such method: %s' % cmd 396 msg = 'no such method: %s' % cmd
401 raise ErrorResponse(HTTP_BAD_REQUEST, msg) 397 raise ErrorResponse(HTTP_BAD_REQUEST, msg)