mercurial/hgweb/hgweb_mod.py
changeset 36861 a88d68dc3ee8
parent 36856 1f7d9024674c
child 36863 1a1972b1a1ff
--- a/mercurial/hgweb/hgweb_mod.py	Sat Mar 10 11:15:05 2018 -0800
+++ b/mercurial/hgweb/hgweb_mod.py	Sat Mar 10 11:23:05 2018 -0800
@@ -305,6 +305,7 @@
 
     def _runwsgi(self, wsgireq, repo):
         req = wsgireq.req
+        res = wsgireq.res
         rctx = requestcontext(self, repo)
 
         # This state is global across all threads.
@@ -317,11 +318,12 @@
             wsgireq.headers = [h for h in wsgireq.headers
                                if h[0] != 'Content-Security-Policy']
             wsgireq.headers.append(('Content-Security-Policy', rctx.csp))
+            res.headers['Content-Security-Policy'] = rctx.csp
 
-        handled, res = wireprotoserver.handlewsgirequest(
-            rctx, wsgireq, req, self.check_perm)
+        handled = wireprotoserver.handlewsgirequest(
+            rctx, wsgireq, req, res, self.check_perm)
         if handled:
-            return res
+            return res.sendresponse()
 
         if req.havepathinfo:
             query = req.dispatchpath