Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for SSLContext in SafeTransport #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions jsonrpclib/jsonrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
See http://code.google.com/p/jsonrpclib/ for more info.
"""

import sys
import types
from xmlrpclib import Transport as XMLTransport
from xmlrpclib import SafeTransport as XMLSafeTransport
Expand Down Expand Up @@ -161,9 +162,12 @@ def __init__(self):


class SafeTransport(TransportMixIn, XMLSafeTransport):
def __init__(self):
def __init__(self, context=None):
TransportMixIn.__init__(self)
XMLSafeTransport.__init__(self)
if sys.version_info < (2, 7, 9):
XMLSafeTransport.__init__(self)
else:
XMLSafeTransport.__init__(self, context=context)

from httplib import HTTP, HTTPConnection
from socket import socket
Expand Down Expand Up @@ -200,7 +204,7 @@ class ServerProxy(XMLServerProxy):
"""

def __init__(self, uri, transport=None, encoding=None,
verbose=0, version=None):
verbose=0, version=None, context=None):
import urllib
if not version:
version = config.version
Expand All @@ -224,7 +228,7 @@ def __init__(self, uri, transport=None, encoding=None,
if schema == 'unix':
transport = UnixTransport()
elif schema == 'https':
transport = SafeTransport()
transport = SafeTransport(context=context)
else:
transport = Transport()
self.__transport = transport
Expand Down