fix (render.py): fix non-ascii characters in HTTP headers.
HTTP headers need to be ascii or Gunicorn throws an exception. The error handler 'xmlcharrefreplace' is chosen for no particular reason.
This commit is contained in:
parent
63cb27b924
commit
c57710052e
1 changed files with 2 additions and 2 deletions
|
|
@ -125,12 +125,12 @@ def build_response(path, data, http_status_code, headers=None):
|
|||
response = Response()
|
||||
response.data = set_content_type(response, data, path)
|
||||
response.status_code = http_status_code
|
||||
response.headers["X-Page-Name"] = path.encode("utf-8")
|
||||
response.headers["X-Page-Name"] = path.encode("ascii", errors="xmlcharrefreplace")
|
||||
response.headers["X-From-Cache"] = frappe.local.response.from_cache or False
|
||||
|
||||
if headers:
|
||||
for key, val in iteritems(headers):
|
||||
response.headers[key] = val.encode("utf-8")
|
||||
response.headers[key] = val.encode("ascii", errors="xmlcharrefreplace")
|
||||
|
||||
return response
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue