/usr/lib/python2.7/dist-packages/cherrypy/filters/responseheadersfilter.py is in python-cherrypy 2.3.0-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | import cherrypy
from basefilter import BaseFilter
class ResponseHeadersFilter(BaseFilter):
"""Filter that allows HTTP headers to be defined for all responses"""
def before_finalize(self):
conf = cherrypy.config.get
if not conf('response_headers_filter.on', False):
return
# headers must be a list of tuples
headers = conf('response_headers_filter.headers', [])
for item in headers:
headername = item[0]
headervalue = item[1]
if headername not in cherrypy.response.headerMap:
cherrypy.response.headerMap[headername] = headervalue
|