Closed tjwalton closed 5 years ago
(fast answer, as I don't have access to the repo on this computer) I'll try to reproduce the bug this evening (UTC+1).
From what I understand, could you try to replace the SafeTransport of jsonrpclib by the following code?
class SafeTransport(TransportMixIn, XMLSafeTransport):
"""
Mixed-in HTTPS transport
"""
def __init__(self, config, context):
TransportMixIn.__init__(self, config, context)
try:
# Use the context argument when available
XMLSafeTransport.__init__(self, context=context)
except TyperError:
# Compatibility with previous Python versions
XMLSafeTransport.__init__(self)
Yes, that works (with the typo TyperError
changed to TypeError
).
Thanks for the quick response.
If I run the following code on Python 2.7.13 against a server with an invalid certificate then it raises an
ssl.CertificateError
exception:It should not give a CertificateError exception.
The problem occurs because a
context
parameter was added to xmlrpclib.SafeTransport in https://github.com/python/cpython/commit/efa3cf84d2a05650a7d2e83a4914b66f7d0a65be, so when the line at https://github.com/tcalmant/jsonrpclib/blob/3bfd2f3/jsonrpclib/jsonrpc.py#L467 callsTransportMixin.__init__(self, config, context)
(which sets self.context), the lineXMLSafeTransport.__init__(self)
resetsself.context
toNone
.From code inspection, it looks likely to be broken in Python 3 too.