diff options
author | Timshel <Timshel@users.noreply.github.com> | 2024-05-08 15:56:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-08 13:56:16 +0000 |
commit | 34a8652366c60d785e5c0510749e615d0dec9ec0 (patch) | |
tree | 7ec986f3c034b9f723ba72cfd37657f5d13eac4a /synapse/federation | |
parent | Update PyO3 to 0.21 (#17162) (diff) | |
download | synapse-34a8652366c60d785e5c0510749e615d0dec9ec0.tar.xz |
Optional whitespace support in Authorization (#1350) (#17145)
Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
Diffstat (limited to 'synapse/federation')
-rw-r--r-- | synapse/federation/transport/server/_base.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/federation/transport/server/_base.py b/synapse/federation/transport/server/_base.py index 23d1254127..db0f5076a9 100644 --- a/synapse/federation/transport/server/_base.py +++ b/synapse/federation/transport/server/_base.py @@ -180,7 +180,11 @@ def _parse_auth_header(header_bytes: bytes) -> Tuple[str, str, str, Optional[str """ try: header_str = header_bytes.decode("utf-8") - params = re.split(" +", header_str)[1].split(",") + space_or_tab = "[ \t]" + params = re.split( + rf"{space_or_tab}*,{space_or_tab}*", + re.split(r"^X-Matrix +", header_str, maxsplit=1)[1], + ) param_dict: Dict[str, str] = { k.lower(): v for k, v in [param.split("=", maxsplit=1) for param in params] } |