Skip to content

Commit 6180bf1

Browse files
committed
Remove RPC over SSL support
Removed in Bitcoin Core v0.12.0
1 parent 059b447 commit 6180bf1

File tree

2 files changed

+9
-37
lines changed

2 files changed

+9
-37
lines changed

bitcoin/rpc.py

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -109,65 +109,33 @@ def __init__(self,
109109
if service_port is None:
110110
service_port = bitcoin.params.RPC_PORT
111111
conf['rpcport'] = int(conf.get('rpcport', service_port))
112-
conf['rpcssl'] = conf.get('rpcssl', '0')
113112
conf['rpchost'] = conf.get('rpcconnect', 'localhost')
114113

115-
if conf['rpcssl'].lower() in ('0', 'false'):
116-
conf['rpcssl'] = False
117-
elif conf['rpcssl'].lower() in ('1', 'true'):
118-
conf['rpcssl'] = True
119-
else:
120-
raise ValueError('Unknown rpcssl value %r' % conf['rpcssl'])
121-
122-
if conf['rpcssl'] and 'rpcsslcertificatechainfile' in conf and 'rpcsslprivatekeyfile' in conf:
123-
self.__ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
124-
if os.path.exists(conf['rpcsslcertificatechainfile']):
125-
certificate = conf['rpcsslcertificatechainfile']
126-
elif os.path.exists(os.path.join(os.path.dirname(btc_conf_file), conf['rpcsslcertificatechainfile'])):
127-
certificate = os.path.join(os.path.dirname(btc_conf_file), conf['rpcsslcertificatechainfile'])
128-
else:
129-
raise ValueError('The value of rpcsslcertificatechainfile is not correctly specified in the configuration file: %s' % btc_conf_file)
130-
if os.path.exists(conf['rpcsslprivatekeyfile']):
131-
private_key = conf['rpcsslprivatekeyfile']
132-
elif os.path.exists(os.path.join(os.path.dirname(btc_conf_file), conf['rpcsslprivatekeyfile'])):
133-
private_key = os.path.join(os.path.dirname(btc_conf_file), conf['rpcsslprivatekeyfile'])
134-
else:
135-
raise ValueError('The value of rpcsslprivatekeyfile is not correctly specified in the configuration file: %s' % btc_conf_file)
136-
self.__ssl_context.load_cert_chain(certificate, private_key)
137-
138114
if 'rpcpassword' not in conf:
139115
raise ValueError('The value of rpcpassword not specified in the configuration file: %s' % btc_conf_file)
140116

141117
service_url = ('%s://%s:%s@%s:%d' %
142-
('https' if conf['rpcssl'] else 'http',
118+
('http',
143119
conf['rpcuser'], conf['rpcpassword'],
144120
conf['rpchost'], conf['rpcport']))
145121

146122
self.__service_url = service_url
147123
self.__url = urlparse.urlparse(service_url)
148124

149-
if self.__url.scheme not in ('https', 'http'):
125+
if self.__url.scheme not in ('http',):
150126
raise ValueError('Unsupported URL scheme %r' % self.__url.scheme)
151127

152128
if self.__url.port is None:
153-
if self.__url.scheme == 'https':
154-
port = httplib.HTTPS_PORT
155-
else:
156-
port = httplib.HTTP_PORT
129+
port = httplib.HTTP_PORT
157130
else:
158131
port = self.__url.port
159132
self.__id_count = 0
160133
authpair = "%s:%s" % (self.__url.username, self.__url.password)
161134
authpair = authpair.encode('utf8')
162135
self.__auth_header = b"Basic " + base64.b64encode(authpair)
163136

164-
if self.__url.scheme == 'https':
165-
self.__conn = httplib.HTTPSConnection(self.__url.hostname, port=port,
166-
context=self.__ssl_context,
167-
timeout=timeout)
168-
else:
169-
self.__conn = httplib.HTTPConnection(self.__url.hostname, port=port,
170-
timeout=timeout)
137+
self.__conn = httplib.HTTPConnection(self.__url.hostname, port=port,
138+
timeout=timeout)
171139

172140

173141
def _call(self, service_name, *args):

release-notes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ v0.6.0-SNAPSHOT (not yet released!)
66

77
Breaking API changes:
88

9+
* RPC over SSL support removed to match Bitcoin Core's removal of RPC SSL
10+
support in v0.12.0 If you need this, use an alternative such as a stunnel or
11+
a SSH tunnel.
12+
913
* Removed SCRIPT_VERIFY constants ``bitcoin.core.script``, leaving just the
1014
constants in ``bitcoin.core.scripteval``; being singletons the redundant
1115
constants were broken anyway.

0 commit comments

Comments
 (0)