From 677be13ffc5c463acacf2d420ca9c47f2f7cba65 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 19 May 2015 13:12:28 +0100 Subject: [PATCH 1/5] Revert accidental commit --- synapse/app/homeserver.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index 2e11ac062f..dfb5314ff7 100755 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -85,10 +85,10 @@ class SynapseHomeServer(HomeServer): return MatrixFederationHttpClient(self) def build_resource_for_client(self): - return ClientV1RestResource(self) + return gz_wrap(ClientV1RestResource(self)) def build_resource_for_client_v2_alpha(self): - return ClientV2AlphaRestResource(self) + return gz_wrap(ClientV2AlphaRestResource(self)) def build_resource_for_federation(self): return JsonResource(self) @@ -97,7 +97,7 @@ class SynapseHomeServer(HomeServer): import syweb syweb_path = os.path.dirname(syweb.__file__) webclient_path = os.path.join(syweb_path, "webclient") - return File(webclient_path) # TODO configurable? + return GzipFile(webclient_path) # TODO configurable? def build_resource_for_static_content(self): # This is old and should go away: not going to bother adding gzip From d3e09f12d041c39a8b18df79abeb6383c708f73d Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 19 May 2015 13:12:41 +0100 Subject: [PATCH 2/5] SYN-383: Actually, we expect this value to be a dict --- synapse/crypto/keyring.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/synapse/crypto/keyring.py b/synapse/crypto/keyring.py index a061def16a..2a5a8914c0 100644 --- a/synapse/crypto/keyring.py +++ b/synapse/crypto/keyring.py @@ -312,8 +312,9 @@ class Keyring(object): time_now_ms = self.clock.time_msec() response_keys = {} verify_keys = {} - for key_id, key_base64 in response_json["verify_keys"].items(): + for key_id, key_data in response_json["verify_keys"].items(): if is_signing_algorithm_supported(key_id): + key_base64 = key_data["key"] key_bytes = decode_base64(key_base64) verify_key = decode_verify_key_bytes(key_id, key_bytes) verify_key.time_added = time_now_ms From 882ac83d8d314c5e1490197aaadd19efcbaaf168 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 19 May 2015 13:12:55 +0100 Subject: [PATCH 3/5] Fix scripts-dev/convert_server_keys.py to have correct format --- scripts-dev/convert_server_keys.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts-dev/convert_server_keys.py b/scripts-dev/convert_server_keys.py index 024ddcdbd0..7080ec5fd2 100644 --- a/scripts-dev/convert_server_keys.py +++ b/scripts-dev/convert_server_keys.py @@ -47,7 +47,10 @@ def convert_v1_to_v2(server_name, valid_until, keys, certificate): return { "old_verify_keys": {}, "server_name": server_name, - "verify_keys": keys, + "verify_keys": { + key_id: {"key": key} + for key_id, key in keys + }, "valid_until_ts": valid_until, "tls_fingerprints": [fingerprint(certificate)], } From df431b127b54df3d5e5c398e48a134dc66d29ebd Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 19 May 2015 13:14:21 +0100 Subject: [PATCH 4/5] Add forgotten .items() --- scripts-dev/convert_server_keys.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts-dev/convert_server_keys.py b/scripts-dev/convert_server_keys.py index 7080ec5fd2..a1ee39059c 100644 --- a/scripts-dev/convert_server_keys.py +++ b/scripts-dev/convert_server_keys.py @@ -49,7 +49,7 @@ def convert_v1_to_v2(server_name, valid_until, keys, certificate): "server_name": server_name, "verify_keys": { key_id: {"key": key} - for key_id, key in keys + for key_id, key in keys.items() }, "valid_until_ts": valid_until, "tls_fingerprints": [fingerprint(certificate)], From 19505e03921e2e239e99233f3faae083c105501a Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 19 May 2015 13:19:47 +0100 Subject: [PATCH 5/5] Disable GZip encoding on static file resources as per comment --- synapse/app/homeserver.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index dfb5314ff7..fa43211415 100755 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -97,7 +97,13 @@ class SynapseHomeServer(HomeServer): import syweb syweb_path = os.path.dirname(syweb.__file__) webclient_path = os.path.join(syweb_path, "webclient") - return GzipFile(webclient_path) # TODO configurable? + # GZip is disabled here due to + # https://twistedmatrix.com/trac/ticket/7678 + # (It can stay enabled for the API resources: they call + # write() with the whole body and then finish() straight + # after and so do not trigger the bug. + # return GzipFile(webclient_path) # TODO configurable? + return File(webclient_path) # TODO configurable? def build_resource_for_static_content(self): # This is old and should go away: not going to bother adding gzip