From bcbab3ef199d72fccdef7a1fa45efd68c877048d Mon Sep 17 00:00:00 2001 From: Aaron Blankstein Date: Wed, 16 Aug 2017 17:23:40 -0400 Subject: [PATCH] fixes bug in https support changes by making rpc proxy default to 'http' --- blockstack_client/backend/registrar.py | 4 ++-- blockstack_client/proxy.py | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/blockstack_client/backend/registrar.py b/blockstack_client/backend/registrar.py index 85ce90d31..b1be6bca6 100644 --- a/blockstack_client/backend/registrar.py +++ b/blockstack_client/backend/registrar.py @@ -521,7 +521,7 @@ class RegistrarWorker(threading.Thread): atlas_servers = cls.get_atlas_server_list( config_path ) if 'error' in atlas_servers: - log.warn('Failed to get server list: {}'.format(servers['error'])) + log.warn('Failed to get server list: {}'.format(atlas_servers['error'])) return {'error': 'Failed to get Atlas server list'} for update in updates: @@ -656,7 +656,7 @@ class RegistrarWorker(threading.Thread): atlas_peers_res = {} try: - atlas_peers_res = get_atlas_peers( server_hostport ) + atlas_peers_res = get_atlas_peers( server_hostport, proxy = get_default_proxy() ) assert 'error' not in atlas_peers_res servers += atlas_peers_res['peers'] diff --git a/blockstack_client/proxy.py b/blockstack_client/proxy.py index 4beba60c9..5db3c9c11 100644 --- a/blockstack_client/proxy.py +++ b/blockstack_client/proxy.py @@ -133,7 +133,9 @@ class BlockstackRPCClient(object): timeout=DEFAULT_TIMEOUT, debug_timeline=False, protocol=None, **kw): if protocol is None: - raise Exception("RPC constructor must be passed a protocol") + log.warn("RPC constructor called without a protocol, defaulting " + + "to HTTP, this could be an issue if connection is on :6263") + protocol = 'http' self.url = '{}://{}:{}'.format(protocol, server, port) self.srv = TimeoutServerProxy(self.url, protocol, timeout=timeout, allow_none=True) self.server = server @@ -1971,7 +1973,7 @@ def get_zonefile_inventory(hostport, bit_offset, bit_count, timeout=30, my_hostp if proxy is None: host, port = url_to_host_port(hostport) assert host is not None and port is not None - proxy = BlockstackRPCClient(host, port, timeout=timeout, src=my_hostport) + proxy = BlockstackRPCClient(host, port, timeout=timeout, src=my_hostport, protocol = 'http') zf_inv = None try: @@ -2027,11 +2029,10 @@ def get_atlas_peers(hostport, timeout=30, my_hostport=None, proxy=None): schema = json_response_schema( peers_schema ) - if proxy is None: host, port = url_to_host_port(hostport) assert host is not None and port is not None - proxy = BlockstackRPCClient(host, port, timeout=timeout, src=my_hostport) + proxy = BlockstackRPCClient(host, port, timeout=timeout, src=my_hostport, protocol = 'http') peers = None try: