Skip to content

Commit

Permalink
Merge aa6d5b0 into b784c70
Browse files Browse the repository at this point in the history
  • Loading branch information
citrus-it committed Oct 9, 2020
2 parents b784c70 + aa6d5b0 commit aee7b9a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions jsonrpclib/jsonrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
# Python 3
# pylint: disable=F0401,E0611
from http.client import HTTPConnection
from urllib.parse import splittype, splithost
from urllib.parse import urlparse
from xmlrpc.client import Transport as XMLTransport
from xmlrpc.client import SafeTransport as XMLSafeTransport
from xmlrpc.client import ServerProxy as XMLServerProxy
Expand Down Expand Up @@ -567,7 +567,15 @@ def __init__(self, uri, transport=None, encoding=None,
self._config = config
self.__version = version or config.version

schema, uri = splittype(uri)
if sys.version_info[0] < 3:
schema, uri = splittype(uri)
self.__host, self.__handler = splithost(uri)
else:
su = urlparse(uri)
schema = su.scheme
self.__host = su.netloc
self.__handler = su.path

use_unix = False
if schema.startswith("unix+"):
schema = schema[len("unix+"):]
Expand All @@ -578,7 +586,6 @@ def __init__(self, uri, transport=None, encoding=None,
schema)
raise IOError('Unsupported JSON-RPC protocol.')

self.__host, self.__handler = splithost(uri)
if use_unix:
unix_path = self.__handler
self.__handler = '/'
Expand Down

0 comments on commit aee7b9a

Please sign in to comment.