Make copy of headers before mutating

This commit is contained in:
Unrud 2016-09-02 04:19:19 +02:00 committed by Unrud
parent f7e995f9f6
commit 20b1480399

View File

@ -265,6 +265,7 @@ class Application:
"""Manage a request."""
def response(status, headers={}, answer=None):
headers = headers.copy()
# Set content length
if answer:
self.logger.debug("Response content:\n%s", answer)
@ -380,6 +381,7 @@ class Application:
self.logger.info("%s refused" % (user or "Anonymous user"))
status = client.UNAUTHORIZED
realm = self.configuration.get("server", "realm")
headers = headers.copy()
headers.update ({
"WWW-Authenticate":
"Basic realm=\"%s\"" % realm})