Ng Pheng Siong
ngps at madcap.dyndns.org
Fri May 5 17:44:59 CEST 2000
According to 5ÛHH575-UAZWKVVP-7H2H48V3 <thomas at cintra.no>:
> Trying out the xmlrpclib with my local zope-site. Read in the How-To
> by Amos, located at zope.org, that the pythonware "version" of
> xmlrpclib needed some fixing,
Amos's tutorial talks about creating a BasicAuthTransport class
derived from xmlrpclib.Transport. Just stick his code at the
end of xmlrpclib.py.
Alternatively, you can patch xmlrpclib.Transport directly:
--- xmlrpclib.py.orig Fri May 5 23:34:08 2000
+++ xmlrpclib-auth.py Fri May 5 23:36:16 2000
@@ -555,18 +555,25 @@
def request(self, host, handler, request_body):
# issue XML-RPC request
+ user_passwd, host_port = urllib.splituser(host)
+ _host, _port = urllib.splitport(host_port)
- h = httplib.HTTP(host)
+ h = httplib.HTTP(_host, int(_port))
# required by HTTP/1.1
- h.putheader("Host", host)
+ h.putheader("Host", _host)
# required by XML-RPC
+ # Authorisation.
+ if user_passwd is not None:
+ h.putheader('Authorization', 'Basic %s' % auth)
FWIW, I have also a patch to let xmlrpclib talk through
a http proxy. Let me know if you want it.
FWIW2, M2Crypto comes with xmlrpclib2.py, which extends
xmlrpclib to work over https.
Ng Pheng Siong <ngps at post1.com> * http://www.post1.com/home/ngps
More information about the Python-list