Need XML-RPC help

Ng Pheng Siong ngps at post1.com
Tue Jan 25 09:50:23 EST 2000


In article <B4B0ED62.316E%tony.mcdonald at ncl.ac.uk>,
  Tony McDonald <tony.mcdonald at ncl.ac.uk> wrote:
> Problem is, I can't get XML-RPC to work through our proxy.

[Apologies if you see this more than once. My ISP sucks.]

Try this patch:

*** xmlrpclib.py.orig   Sun Sep 19 16:00:47 1999
--- xmlrpclib.py        Sun Sep 19 16:01:02 1999
***************
*** 553,564 ****
      # client identifier (may be overridden)
      user_agent = "xmlrpclib.py/%s (by www.pythonware.com)" %
__version__

      def request(self, host, handler, request_body):
          # issue XML-RPC request

          import httplib
!         h = httplib.HTTP(host)
!         h.putrequest("POST", handler)

          # required by HTTP/1.1          h.putheader("Host", host)
--- 553,576 ----
      # client identifier (may be overridden)
      user_agent = "xmlrpclib.py/%s (by www.pythonware.com)" %
__version__

+     def __init__(self, proxy_host=None, proxy_port=8080):
+         self.use_proxy=0
+         if proxy_host is not None:
+             self.proxy_host=proxy_host
+             self.proxy_port=proxy_port
+             self.use_proxy=1
+
      def request(self, host, handler, request_body):
          # issue XML-RPC request

          import httplib
!         req='http://%s%s' % (host, handler)
!
!         if self.use_proxy:
!             h = httplib.HTTP(self.proxy_host, self.proxy_port)
!         else:
!             h = httplib.HTTP(host)
!         h.putrequest("POST", req)

          # required by HTTP/1.1
          h.putheader("Host", host)

--
Ng Pheng Siong <ngps at post1.com> * http://www.post1.com/home/ngps



Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list