summary refs log tree commit diff
path: root/synapse/rest/client/v1/login.py
diff options
context:
space:
mode:
authorDavid Baker <dbkr@users.noreply.github.com>2017-03-15 13:52:34 +0000
committerGitHub <noreply@github.com>2017-03-15 13:52:34 +0000
commit0ad44acb5a9c879bacb4cb9e8d9c6230c23274e6 (patch)
treea02aa014680bed747adc2b9540349be6519d7560 /synapse/rest/client/v1/login.py
parentMerge pull request #2010 from matrix-org/rav/fix_txnq_wedge (diff)
parentHandle PartialDownloadError in CAS login (diff)
downloadsynapse-0ad44acb5a9c879bacb4cb9e8d9c6230c23274e6.tar.xz
Merge pull request #1997 from matrix-org/dbkr/cas_partialdownload
Handle PartialDownloadError in CAS login
Diffstat (limited to 'synapse/rest/client/v1/login.py')
-rw-r--r--synapse/rest/client/v1/login.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/synapse/rest/client/v1/login.py b/synapse/rest/client/v1/login.py
index c4bbb70277..a43410fb37 100644
--- a/synapse/rest/client/v1/login.py
+++ b/synapse/rest/client/v1/login.py
@@ -34,6 +34,8 @@ from saml2.client import Saml2Client
 
 import xml.etree.ElementTree as ET
 
+from twisted.web.client import PartialDownloadError
+
 
 logger = logging.getLogger(__name__)
 
@@ -417,7 +419,12 @@ class CasTicketServlet(ClientV1RestServlet):
             "ticket": request.args["ticket"],
             "service": self.cas_service_url
         }
-        body = yield http_client.get_raw(uri, args)
+        try:
+            body = yield http_client.get_raw(uri, args)
+        except PartialDownloadError as pde:
+            # Twisted raises this error if the connection is closed,
+            # even if that's being used old-http style to signal end-of-data
+            body = pde.response
         result = yield self.handle_cas_response(request, body, client_redirect_url)
         defer.returnValue(result)