summary refs log tree commit diff
path: root/synapse/http/client.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@element.io>2024-03-26 13:26:46 +0000
committerGitHub <noreply@github.com>2024-03-26 13:26:46 +0000
commitc900d18647b7ad787c6df5a9a83b225758161c4e (patch)
treec20bf9fbcd36567b8df7291518ace3608dd78f14 /synapse/http/client.py
parentEnsure that pending to-device events are sent over federation at startup (#16... (diff)
downloadsynapse-c900d18647b7ad787c6df5a9a83b225758161c4e.tar.xz
Fix OIDC login regression (#17031)
Requests may require a User-Agent header, and the change in #16972
accidentally removed it, resulting in requests getting rejected causing
login to fail.
Diffstat (limited to '')
-rw-r--r--synapse/http/client.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py
index 08a8634dae..4718517c97 100644
--- a/synapse/http/client.py
+++ b/synapse/http/client.py
@@ -390,6 +390,13 @@ class BaseHttpClient:
                         cooperator=self._cooperator,
                     )
 
+                # Always make sure we add a user agent to the request
+                if headers is None:
+                    headers = Headers()
+
+                if not headers.hasHeader("User-Agent"):
+                    headers.addRawHeader("User-Agent", self.user_agent)
+
                 request_deferred: defer.Deferred = treq.request(
                     method,
                     uri,