diff options
author | Mark Haines <mjark@negativecurvature.net> | 2016-02-12 14:29:36 +0000 |
---|---|---|
committer | Mark Haines <mjark@negativecurvature.net> | 2016-02-12 14:29:36 +0000 |
commit | 66f9a49ce989cdd72fdbfd0acd88a3ee66ae04e1 (patch) | |
tree | 1fc9e3c4ba992e6c35efb68dc9a62a7fa021295a /synapse/rest/client/v1 | |
parent | Merge branch 'master' of github.com:matrix-org/synapse into develop (diff) | |
parent | Catch the exceptions thrown by twisted when you write to a closed connection (diff) | |
download | synapse-66f9a49ce989cdd72fdbfd0acd88a3ee66ae04e1.tar.xz |
Merge pull request #574 from matrix-org/markjh/connection_closed
Catch the exceptions thrown by twisted when you write to a closed con…
Diffstat (limited to 'synapse/rest/client/v1')
-rw-r--r-- | synapse/rest/client/v1/login.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/synapse/rest/client/v1/login.py b/synapse/rest/client/v1/login.py index 7199113dac..79101106ac 100644 --- a/synapse/rest/client/v1/login.py +++ b/synapse/rest/client/v1/login.py @@ -17,6 +17,8 @@ from twisted.internet import defer from synapse.api.errors import SynapseError, LoginError, Codes from synapse.types import UserID +from synapse.http.server import finish_request + from base import ClientV1RestServlet, client_path_patterns import simplejson as json @@ -263,7 +265,7 @@ class SAML2RestServlet(ClientV1RestServlet): '?status=authenticated&access_token=' + token + '&user_id=' + user_id + '&ava=' + urllib.quote(json.dumps(saml2_auth.ava))) - request.finish() + finish_request(request) defer.returnValue(None) defer.returnValue((200, {"status": "authenticated", "user_id": user_id, "token": token, @@ -272,7 +274,7 @@ class SAML2RestServlet(ClientV1RestServlet): request.redirect(urllib.unquote( request.args['RelayState'][0]) + '?status=not_authenticated') - request.finish() + finish_request(request) defer.returnValue(None) defer.returnValue((200, {"status": "not_authenticated"})) @@ -309,7 +311,7 @@ class CasRedirectServlet(ClientV1RestServlet): "service": "%s?%s" % (hs_redirect_url, client_redirect_url_param) }) request.redirect("%s?%s" % (self.cas_server_url, service_param)) - request.finish() + finish_request(request) class CasTicketServlet(ClientV1RestServlet): @@ -362,7 +364,7 @@ class CasTicketServlet(ClientV1RestServlet): redirect_url = self.add_login_token_to_redirect_url(client_redirect_url, login_token) request.redirect(redirect_url) - request.finish() + finish_request(request) def add_login_token_to_redirect_url(self, url, token): url_parts = list(urlparse.urlparse(url)) |