summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2015-12-03 17:00:59 +0000
committerMark Haines <mjark@negativecurvature.net>2015-12-03 17:00:59 +0000
commitb29d2fd7f8df9bda3bd2a2db9af6a9430619febf (patch)
tree9927ae114dc3f36d668191bd8c854afb61c5c6e1 /synapse
parentFlatten devices into a dict, not a list (diff)
parentReuse the captcha client rather than creating a new one for each request (diff)
downloadsynapse-b29d2fd7f8df9bda3bd2a2db9af6a9430619febf.tar.xz
Merge pull request #419 from matrix-org/markjh/reuse_captcha_client
Reuse the captcha client rather than creating a new one for each request
Diffstat (limited to 'synapse')
-rw-r--r--synapse/handlers/register.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py
index 5166bc7b62..a037da0f70 100644
--- a/synapse/handlers/register.py
+++ b/synapse/handlers/register.py
@@ -42,6 +42,7 @@ class RegistrationHandler(BaseHandler):
 
         self.distributor = hs.get_distributor()
         self.distributor.declare("registered_user")
+        self.captch_client = CaptchaServerHttpClient(hs)
 
     @defer.inlineCallbacks
     def check_username(self, localpart):
@@ -306,10 +307,7 @@ class RegistrationHandler(BaseHandler):
         """
         Used only by c/s api v1
         """
-        # TODO: get this from the homeserver rather than creating a new one for
-        # each request
-        client = CaptchaServerHttpClient(self.hs)
-        data = yield client.post_urlencoded_get_raw(
+        data = yield self.captcha_client.post_urlencoded_get_raw(
             "http://www.google.com:80/recaptcha/api/verify",
             args={
                 'privatekey': private_key,