From 7ea38a0c9d64b355aa6e1adf54728663207e77a6 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 17 Oct 2014 21:28:32 +0100 Subject: [PATCH 01/10] Update changelong and upgrade --- CHANGES.rst | 2 ++ UPGRADE.rst | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index dab9285f3b..93d651e66d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,8 @@ compatible. The Matrix specification has been moved to a seperate git repository. +You will also need an updated syutil and config. See UPGRADES.rst. + Homeserver: * Sign federation transactions. * Rename timestamp keys in PDUs. diff --git a/UPGRADE.rst b/UPGRADE.rst index 713fb9ae83..9746630dd7 100644 --- a/UPGRADE.rst +++ b/UPGRADE.rst @@ -1,3 +1,16 @@ +Upgrading to v0.4.0 +=================== + +This release needs an updated syutil version. Run:: + + python setup.py develop + +You will also need to upgrade your configuration as the signing key format has +changed. Run:: + + python -m synapse.app.homeserver --config-path --generate-config + + Upgrading to v0.3.0 =================== From cb939ed450da34216db20d6f4494a03ac0107ca2 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 17 Oct 2014 21:29:28 +0100 Subject: [PATCH 02/10] I can't type apparently --- CHANGES.rst | 2 +- UPGRADE.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 93d651e66d..995718c3a4 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -3,7 +3,7 @@ Changes in synpase 0.4.0 (2014-10-17) This server includes changes to the federation protocol that is not backwards compatible. -The Matrix specification has been moved to a seperate git repository. +The Matrix specification has been moved to a separate git repository. You will also need an updated syutil and config. See UPGRADES.rst. diff --git a/UPGRADE.rst b/UPGRADE.rst index 9746630dd7..99ce1a2d3d 100644 --- a/UPGRADE.rst +++ b/UPGRADE.rst @@ -8,7 +8,7 @@ This release needs an updated syutil version. Run:: You will also need to upgrade your configuration as the signing key format has changed. Run:: - python -m synapse.app.homeserver --config-path --generate-config + python -m synapse.app.homeserver --config-path --generate-config Upgrading to v0.3.0 From 4c8111ef98762d96c47f1fde1efa8b9496f25c13 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Sat, 18 Oct 2014 00:28:36 +0200 Subject: [PATCH 03/10] Bunp to change log. --- CHANGES.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 995718c3a4..0645dca127 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,8 @@ +Changes in synapse 0.4.1 (2014-10-17) +===================================== +Webclient: + * Fix bug with display of timestamps. + Changes in synpase 0.4.0 (2014-10-17) ===================================== This server includes changes to the federation protocol that is not backwards From f22d023c4bd73e16bc649e1472f10a0f128aaab6 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Sat, 18 Oct 2014 00:29:15 +0200 Subject: [PATCH 04/10] Bump version --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 1d0ba9ea18..267577d47e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.0 +0.4.1 From b3e6cd59a1c377f81c577e9159c49f6e06cab706 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Sat, 18 Oct 2014 00:29:55 +0200 Subject: [PATCH 05/10] Bump the other version --- synapse/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapse/__init__.py b/synapse/__init__.py index 979eac08a7..7067188c5b 100644 --- a/synapse/__init__.py +++ b/synapse/__init__.py @@ -16,4 +16,4 @@ """ This is a reference implementation of a synapse home server. """ -__version__ = "0.4.0" +__version__ = "0.4.1" From 8f0997d17d9db94bbe706b9d32c91694e3883e42 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Sat, 18 Oct 2014 11:46:11 +0100 Subject: [PATCH 06/10] improve changelog slightly --- CHANGES.rst | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 0645dca127..08efbbf244 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,16 +5,18 @@ Webclient: Changes in synpase 0.4.0 (2014-10-17) ===================================== -This server includes changes to the federation protocol that is not backwards -compatible. +This release includes changes to the federation protocol and client-server API +that is not backwards compatible. -The Matrix specification has been moved to a separate git repository. +The Matrix specification has been moved to a separate git repository: +http://github.com/matrix-org/matrix-doc You will also need an updated syutil and config. See UPGRADES.rst. Homeserver: - * Sign federation transactions. - * Rename timestamp keys in PDUs. + * Sign federation transactions to assert strong identity over federation. + * Rename timestamp keys in PDUs and events from 'ts' and 'hsob_ts' to 'origin_server_ts'. + Changes in synapse 0.3.4 (2014-09-25) ===================================== From 9c0826592c8c8dcfe0e3bc0f99bacabd772791f2 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Sat, 18 Oct 2014 16:56:44 +0100 Subject: [PATCH 07/10] Fix auto generating signing_keys --- synapse/config/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapse/config/server.py b/synapse/config/server.py index d9d8d0e14e..9332e4acd7 100644 --- a/synapse/config/server.py +++ b/synapse/config/server.py @@ -94,7 +94,7 @@ class ServerConfig(Config): with open(args.signing_key_path, "w") as signing_key_file: syutil.crypto.signing_key.write_signing_keys( signing_key_file, - (syutil.crypto.SigningKey.generate("auto"),), + (syutil.crypto.signing_key.generate_singing_key("auto"),), ) else: signing_keys = cls.read_file(args.signing_key_path, "signing_key") From 4be99c2989799fa4d62682d94aa5b6f90d7750ed Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Mon, 20 Oct 2014 14:10:08 +0100 Subject: [PATCH 08/10] Add get_json method to 3pid http client. Better logging for errors in 3pid requests --- synapse/handlers/register.py | 3 ++- synapse/http/client.py | 40 +++++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py index df562aa762..94b7890b5e 100644 --- a/synapse/handlers/register.py +++ b/synapse/handlers/register.py @@ -15,6 +15,7 @@ """Contains functions for registering clients.""" from twisted.internet import defer +from twisted.python import log from synapse.types import UserID from synapse.api.errors import ( @@ -126,7 +127,7 @@ class RegistrationHandler(BaseHandler): try: threepid = yield self._threepid_from_creds(c) except: - logger.err() + log.err() raise RegistrationError(400, "Couldn't validate 3pid") if not threepid: diff --git a/synapse/http/client.py b/synapse/http/client.py index 316ca1ccb9..46c90dbb76 100644 --- a/synapse/http/client.py +++ b/synapse/http/client.py @@ -101,7 +101,9 @@ class BaseHttpClient(object): while True: - producer = body_callback(method, url_bytes, headers_dict) + producer = None + if body_callback: + producer = body_callback(method, url_bytes, headers_dict) try: response = yield self.agent.request( @@ -312,6 +314,42 @@ class IdentityServerHttpClient(BaseHttpClient): defer.returnValue(json.loads(body)) + @defer.inlineCallbacks + def get_json(self, destination, path, args={}, retry_on_dns_fail=True): + """ Get's some json from the given host homeserver and path + + Args: + destination (str): The remote server to send the HTTP request + to. + path (str): The HTTP path. + args (dict): A dictionary used to create query strings, defaults to + None. + **Note**: The value of each key is assumed to be an iterable + and *not* a string. + + Returns: + Deferred: Succeeds when we get *any* HTTP response. + + The result of the deferred is a tuple of `(code, response)`, + where `response` is a dict representing the decoded JSON body. + """ + logger.debug("get_json args: %s", args) + + query_bytes = urllib.urlencode(args, True) + logger.debug("Query bytes: %s Retry DNS: %s", args, retry_on_dns_fail) + + response = yield self._create_request( + destination.encode("ascii"), + "GET", + path.encode("ascii"), + query_bytes=query_bytes, + retry_on_dns_fail=retry_on_dns_fail, + body_callback=None + ) + + body = yield readBody(response) + + defer.returnValue(json.loads(body)) class CaptchaServerHttpClient(MatrixHttpClient): """Separate HTTP client for talking to google's captcha servers""" From f0382357cab10b536a1c3029be04367fe20b3864 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Mon, 20 Oct 2014 14:43:37 +0100 Subject: [PATCH 09/10] Use https link to download syutil as not everyone has ssh access to github. --- setup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 7a7e53af39..cff9466345 100755 --- a/setup.py +++ b/setup.py @@ -41,11 +41,12 @@ setup( "py-bcrypt", ], dependency_links=[ - "git+ssh://git@github.com/matrix-org/syutil.git#egg=syutil-0.0.2", + "https://github.com/matrix-org/syutil/tarball/master#egg=syutil-0.0.2", ], setup_requires=[ "setuptools_trial", - "setuptools>=1.0.0", # Needs setuptools that supports git+ssh. It's not obvious when support for this was introduced. + "setuptools>=1.0.0", # Needs setuptools that supports git+ssh. + # TODO: Do we need this now? we don't use git+ssh. "mock" ], include_package_data=True, From 06a5a40e903589c734d9a5c9972a2fdc331959e9 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Mon, 20 Oct 2014 15:11:01 +0100 Subject: [PATCH 10/10] use a tagged version of syutil rather than master --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index cff9466345..649ac86590 100755 --- a/setup.py +++ b/setup.py @@ -41,7 +41,7 @@ setup( "py-bcrypt", ], dependency_links=[ - "https://github.com/matrix-org/syutil/tarball/master#egg=syutil-0.0.2", + "https://github.com/matrix-org/syutil/tarball/v0.0.2#egg=syutil-0.0.2", ], setup_requires=[ "setuptools_trial",