New submission from Andreas Hasenack:
I was trying to use xmlrpclib.ServerProxy() with https and client
certificate validation (I know httplib doesn't do server certificate
validation yet). I found no way to pass on host/uri as a
(host,x509_dict) tuple as the connection methods support, so I came up
with this patch.
----------
components: Library (Lib)
files: xmlrpclib-x509.patch
messages: 58363
nosy: ahasenack
severity: minor
status: open
title: xmlrpclib.ServerProxy() doesn't use x509 data
type: behavior
versions: Python 2.5
Added file: http://bugs.python.org/file8911/xmlrpclib-x509.patch
__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1581>
__________________________________
--- xmlrpclib.py.orig 2007-12-10 17:00:49.000000000 -0200
+++ xmlrpclib.py 2007-12-10 17:37:55.000000000 -0200
@@ -1185,6 +1185,7 @@
errcode, errmsg, headers = h.getreply()
if errcode != 200:
+ host, extra, x509 = self.get_host_info(host)
raise ProtocolError(
host + handler,
errcode, errmsg,
@@ -1382,7 +1383,8 @@
"""uri [,options] -> a logical connection to an XML-RPC server
uri is the connection point on the server, given as
- scheme://host/target.
+ scheme://host/target. It can also be a tuple of the form (uri,x509_dict)
+ where x509_dict is a dictionary specifying files for SSL key and certificate.
The standard implementation always supports the "http" scheme. If
SSL socket support is available (Python 2.0), it also supports
@@ -1404,12 +1406,17 @@
allow_none=0, use_datetime=0):
# establish a "logical" server connection
+ x509 = {}
# get the url
import urllib
+ if isinstance(uri, TupleType):
+ uri, x509 = uri
type, uri = urllib.splittype(uri)
if type not in ("http", "https"):
raise IOError, "unsupported XML-RPC protocol"
self.__host, self.__handler = urllib.splithost(uri)
+ if x509:
+ self.__host = (self.__host, x509)
if not self.__handler:
self.__handler = "/RPC2"
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com