From 4f69a640cb7018cc967c7df840627ec2708e079f Mon Sep 17 00:00:00 2001 From: magic_rb Date: Mon, 16 Oct 2023 17:29:45 +0200 Subject: [PATCH] Fix http/s proxy authentication Signed-off-by: magic_rb --- changelog.d/16504.bugfix | 1 + synapse/http/connectproxyclient.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog.d/16504.bugfix diff --git a/changelog.d/16504.bugfix b/changelog.d/16504.bugfix new file mode 100644 index 000000000000..7fb458251af0 --- /dev/null +++ b/changelog.d/16504.bugfix @@ -0,0 +1 @@ +Fix http/s forward proxy authentication not working. diff --git a/synapse/http/connectproxyclient.py b/synapse/http/connectproxyclient.py index 636efc33e8f3..dd8d148d1607 100644 --- a/synapse/http/connectproxyclient.py +++ b/synapse/http/connectproxyclient.py @@ -59,7 +59,9 @@ def as_proxy_authorization_value(self) -> bytes: a Proxy-Authorization header. """ # Encode as base64 and prepend the authorization type - return b"Basic " + base64.encodebytes(self.username_password) + return b"Basic " + base64.encodebytes(self.username_password).replace( + b"\n", b"" + ) @attr.s(auto_attribs=True)