By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,435 Members | 2,891 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,435 IT Pros & Developers. It's quick & easy.

xmlrpc client through proxy to https server

P: n/a

I'm trying to build a xmlrpc client that uses a proxy to connect to
a xmlrpc server in https.
I've googled and came up with a code snippet that doesn't actually

What is missing?
class ProxiedTransport(xmlrpclib.Transport):
def set_proxy(self, proxy):
self.proxy = proxy
def make_connection(self, host):
self.realhost = host
# i've also tried httplib.HTTPS, in this case I get
# "socket.sslerror: (1, 'error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol')"
h = httplib.HTTP(self.proxy)
#trivial setup for ssl socket
# proxy_connect='CONNECT %s:%s HTTP/1.1\r\n'%('', '443')
# user_agent='User-Agent: python\r\n'
# proxy_pieces=proxy_connect+user_agent+'\r\n'
# proxy=socket.socket(socket.AF_INET,socket.SOCK_STR EAM)
# proxy.connect(('', 3128))
# proxy.sendall(proxy_pieces)
# response=proxy.recv(8192)
# ssl = socket.ssl(proxy, None, None)
# sock = httplib.FakeSocket(proxy, ssl)
# h.sock = sock
return h
def send_request(self, connection, handler, request_body):
connection.putrequest("POST", 'https://%s%s' % (self.realhost, handler))
def send_host(self, connection, host):
connection.putheader('Host', self.realhost)
p = ProxiedTransport()
server = xmlrpclib.Server('', transport=p)
print server.user.ingroup("username", "group")


The Result:

xmlrpclib.ProtocolError: <ProtocolError for 501 Not Implemented>
The method i'm calling is "implemented". If I try straight xmlrpc
connection through a machine that is not behind a firewall things work
Appreciate help


Aug 12 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.