diff --git a/synapse/handlers/identity.py b/synapse/handlers/identity.py index 80b62bbc70e2..fc59d05e34d2 100644 --- a/synapse/handlers/identity.py +++ b/synapse/handlers/identity.py @@ -565,7 +565,7 @@ def proxy_msisdn_submit_token(self, id_server, client_secret, sid, token): raise SynapseError(400, "Error contacting the identity server") @defer.inlineCallbacks - def lookup_3pid(self, id_server, medium, address, id_access_token=None): + def _lookup_3pid(self, id_server, medium, address, id_access_token=None): """Looks up a 3pid in the passed identity server. Args: @@ -649,7 +649,7 @@ def _lookup_3pid_v2(self, id_server, id_access_token, medium, address): """ # Check what hashing details are supported by this identity server try: - hash_details = yield self.http_client.get_json( + hash_details = yield self.blacklisting_http_client.get_json( "%s%s/_matrix/identity/v2/hash_details" % (id_server_scheme, id_server), {"access_token": id_access_token}, ) @@ -716,7 +716,7 @@ def _lookup_3pid_v2(self, id_server, id_access_token, medium, address): headers = {"Authorization": create_id_access_token_header(id_access_token)} try: - lookup_results = yield self.http_client.post_json_get_json( + lookup_results = yield self.blacklisting_http_client.post_json_get_json( "%s%s/_matrix/identity/v2/lookup" % (id_server_scheme, id_server), { "addresses": [lookup_value], @@ -750,7 +750,7 @@ def _verify_any_signature(self, data, server_hostname): raise AuthError(401, "No signature from server %s" % (server_hostname,)) for key_name, signature in data["signatures"][server_hostname].items(): try: - key_data = yield self.http_client.get_json( + key_data = yield self.blacklisting_http_client.get_json( "%s%s/_matrix/identity/api/v1/pubkey/%s" % (id_server_scheme, server_hostname, key_name) ) @@ -843,7 +843,7 @@ def ask_id_server_for_third_party_invite( # Attempt a v2 lookup url = base_url + "/v2/store-invite" try: - data = yield self.http_client.post_json_get_json( + data = yield self.blacklisting_http_client.post_json_get_json( url, invite_config, {"Authorization": create_id_access_token_header(id_access_token)}, @@ -863,7 +863,9 @@ def ask_id_server_for_third_party_invite( url = base_url + "/api/v1/store-invite" try: - data = yield self.http_client.post_json_get_json(url, invite_config) + data = yield self.blacklisting_http_client.post_json_get_json( + url, invite_config + ) except TimeoutError: raise SynapseError(500, "Timed out contacting identity server") except HttpResponseException as e: @@ -879,7 +881,7 @@ def ask_id_server_for_third_party_invite( # types. This is especially true with old instances of Sydent, see # https://github.com/matrix-org/sydent/pull/170 try: - data = yield self.http_client.post_urlencoded_get_json( + data = yield self.blacklisting_http_client.post_urlencoded_get_json( url, invite_config ) except HttpResponseException as e: diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py index 3549e6d93fb2..8abdb1b6e69f 100644 --- a/synapse/handlers/room_member.py +++ b/synapse/handlers/room_member.py @@ -25,7 +25,6 @@ from synapse import types from synapse.api.constants import EventTypes, Membership from synapse.api.errors import AuthError, Codes, SynapseError -from synapse.http.client import SimpleHttpClient from synapse.types import RoomID, UserID from synapse.util.async_helpers import Linearizer from synapse.util.distributor import user_joined_room, user_left_room @@ -54,11 +53,6 @@ def __init__(self, hs): self.auth = hs.get_auth() self.state_handler = hs.get_state_handler() self.config = hs.config - # We create a blacklisting instance of SimpleHttpClient for contacting identity - # servers specified by clients - self.simple_http_client = SimpleHttpClient( - hs, ip_blacklist=hs.config.federation_ip_range_blacklist - ) self.federation_handler = hs.get_handlers().federation_handler self.directory_handler = hs.get_handlers().directory_handler