dotfiles/nixng/containers/matrix/synapse/0001-Fix-http-s-proxy-authentication.patch
magic_rb 39c7d06663
Stabilize synapse patch properly
Signed-off-by: magic_rb <richard@brezak.sk>
2023-10-24 12:58:36 +02:00

37 lines
1.3 KiB
Diff

From 3f0f28bca95f95e227ed9b7aff27e48a445564fd Mon Sep 17 00:00:00 2001
From: magic_rb <richard@brezak.sk>
Date: Mon, 16 Oct 2023 17:29:45 +0200
Subject: [PATCH] Fix http/s proxy authentication
Signed-off-by: magic_rb <richard@brezak.sk>
---
changelog.d/16504.bugfix | 1 +
synapse/http/connectproxyclient.py | 3 +--
2 files changed, 2 insertions(+), 2 deletions(-)
create mode 100644 changelog.d/16504.bugfix
diff --git a/changelog.d/16504.bugfix b/changelog.d/16504.bugfix
new file mode 100644
index 000000000..60839c474
--- /dev/null
+++ b/changelog.d/16504.bugfix
@@ -0,0 +1 @@
+Fix a bug introduced in Synapse 1.41 where HTTP(S) forward proxy authorization would fail when using basic HTTP authentication with a long `username:password` string.
diff --git a/synapse/http/connectproxyclient.py b/synapse/http/connectproxyclient.py
index 636efc33e..5bedca922 100644
--- a/synapse/http/connectproxyclient.py
+++ b/synapse/http/connectproxyclient.py
@@ -59,8 +59,7 @@ class BasicProxyCredentials(ProxyCredentials):
a Proxy-Authorization header.
"""
# Encode as base64 and prepend the authorization type
- return b"Basic " + base64.encodebytes(self.username_password)
-
+ return b"Basic " + base64.b64encode(self.username_password)
@attr.s(auto_attribs=True)
class BearerProxyCredentials(ProxyCredentials):
--
2.42.0