summary refs log tree commit diff
diff options
context:
space:
mode:
authorAyush Anand <iamayushanand@gmail.com>2022-08-18 19:44:47 +0530
committerGitHub <noreply@github.com>2022-08-18 15:14:47 +0100
commit22ea51faf9a29cd9b96189d1fac95eaf2cfcf4ec (patch)
tree5711a01eefa45c5ff77e33e26474e81e8b5fafad
parentAvoid blocking lazy-loading `/sync`s during partial joins (#13477) (diff)
downloadsynapse-22ea51faf9a29cd9b96189d1fac95eaf2cfcf4ec.tar.xz
Add support for compression to federation responses (#13537)
Closes #13415.

Signed-off-by: Ayush Anand <iamayushanand@gmail.com>
-rw-r--r--changelog.d/13537.bugfix1
-rw-r--r--docs/usage/configuration/config_documentation.md2
-rw-r--r--synapse/app/homeserver.py5
3 files changed, 6 insertions, 2 deletions
diff --git a/changelog.d/13537.bugfix b/changelog.d/13537.bugfix
new file mode 100644
index 0000000000..db843504b1
--- /dev/null
+++ b/changelog.d/13537.bugfix
@@ -0,0 +1 @@
+Add support for compression to federation responses.
diff --git a/docs/usage/configuration/config_documentation.md b/docs/usage/configuration/config_documentation.md
index aa175a0d91..cc72966823 100644
--- a/docs/usage/configuration/config_documentation.md
+++ b/docs/usage/configuration/config_documentation.md
@@ -444,7 +444,7 @@ Sub-options for each listener include:
    * `names`: a list of names of HTTP resources. See below for a list of valid resource names.
 
    * `compress`: set to true to enable gzip compression on HTTP bodies for this resource. This is currently only supported with the
-     `client`, `consent` and `metrics` resources.
+     `client`, `consent`, `metrics` and `federation` resources.
 
 * `additional_resources`: Only valid for an 'http' listener. A map of
    additional endpoints which should be loaded via dynamic modules.
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py
index 745e704141..d98012adeb 100644
--- a/synapse/app/homeserver.py
+++ b/synapse/app/homeserver.py
@@ -220,7 +220,10 @@ class SynapseHomeServer(HomeServer):
             resources.update({"/_matrix/consent": consent_resource})
 
         if name == "federation":
-            resources.update({FEDERATION_PREFIX: TransportLayerServer(self)})
+            federation_resource: Resource = TransportLayerServer(self)
+            if compress:
+                federation_resource = gz_wrap(federation_resource)
+            resources.update({FEDERATION_PREFIX: federation_resource})
 
         if name == "openid":
             resources.update(