summary refs log tree commit diff
path: root/synapse/http
diff options
context:
space:
mode:
authorHugh Nimmo-Smith <hughns@matrix.org>2022-11-17 14:34:11 +0000
committerPatrick Cloke <clokep@users.noreply.github.com>2023-05-30 09:43:06 -0400
commit5fe96082d09d1af3dc33b62b6a47a6baca02703c (patch)
tree45f176244f811d9ff34a69511be6ffda8b7230c7 /synapse/http
parentInitial tests for OAuth delegation (diff)
downloadsynapse-5fe96082d09d1af3dc33b62b6a47a6baca02703c.tar.xz
Actually enforce guest + return www-authenticate header
Diffstat (limited to 'synapse/http')
-rw-r--r--synapse/http/server.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/http/server.py b/synapse/http/server.py
index 101dc2e747..04768c6a23 100644
--- a/synapse/http/server.py
+++ b/synapse/http/server.py
@@ -111,6 +111,9 @@ def return_json_error(
         exc: SynapseError = f.value  # type: ignore
         error_code = exc.code
         error_dict = exc.error_dict(config)
+        if exc.headers is not None:
+            for header, value in exc.headers.items():
+                request.setHeader(header, value)
         logger.info("%s SynapseError: %s - %s", request, error_code, exc.msg)
     elif f.check(CancelledError):
         error_code = HTTP_STATUS_REQUEST_CANCELLED
@@ -172,6 +175,9 @@ def return_html_error(
         cme: CodeMessageException = f.value  # type: ignore
         code = cme.code
         msg = cme.msg
+        if cme.headers is not None:
+            for header, value in cme.headers.items():
+                request.setHeader(header, value)
 
         if isinstance(cme, RedirectException):
             logger.info("%s redirect to %s", request, cme.location)