8000 Add HTTPS to supported RPC Proxy protocols · petertodd/python-bitcoinlib@2fabb36 · GitHub
[go: up one dir, main page]

Skip to 10000 content

Commit 2fabb36

Browse files
committed
Add HTTPS to supported RPC Proxy protocols
1 parent 173a73e commit 2fabb36

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

bitcoin/rpc.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,14 @@ def __init__(self,
205205
self.__service_url = service_url
206206
self.__url = urlparse.urlparse(service_url)
207207

208-
if self.__url.scheme not in ('http',):
208+
if self.__url.scheme not in ('http', 'https'):
209209
raise ValueError('Unsupported URL scheme %r' % self.__url.scheme)
210210

211211
if self.__url.port is None:
212-
port = httplib.HTTP_PORT
212+
if self.__url.scheme == 'https':
213+
port = httplib.HTTPS_PORT
214+
else:
215+
port = httplib.HTTP_PORT
213216
else:
214217
port = self.__url.port
215218
self.__id_count = 0
@@ -223,8 +226,12 @@ def __init__(self,
223226
if connection:
224227
self.__conn = connection
225228
else:
226-
self.__conn = httplib.HTTPConnection(self.__url.hostname, port=port,
227-
timeout=timeout)
229+
if self.__url.scheme == 'https':
230+
self.__conn = httplib.HTTPSConnection(self.__url.hostname, port=port,
231+
timeout=timeout)
232+
else:
233+
self.__conn = httplib.HTTPConnection(self.__url.hostname, port=port,
234+
timeout=timeout)
228235

229236
def _call(self, service_name, *args):
230237
self.__id_count += 1

0 commit comments

Comments
 (0)
0