xmlprclib/server not reusing connections

Andrew Bennetts andrew-pythonlist at puzzling.org
Mon Feb 23 23:15:01 EST 2004


On Mon, Feb 23, 2004 at 03:55:08PM -0800, Roger Binns wrote:
[...]
> 
> Basically the existing xmlrpclib and SimpleXMLRPCServer are hard coded
> (and IMHO go out of their way) to do one request per connection, and
> then shut things down.  Throw in that I needed to do SSL on both ends, with
> HTTP authentication, and some "light" firewalling in order to prevent
> DOS attacks, I had to spend several days mashing the various classes
> together with M2Crypto together.

You might have better luck with Twisted <http://twistedmatrix.com/>.

The XML-RPC server support in Twisted does support SSL, and HTTP/1.1
persistent connections, and it's pretty easy to use:

    http://twistedmatrix.com/documents/examples/xmlrpc.py

I don't have any experience with Twisted's XML-RPC client (although you can
see an example at
http://twistedmatrix.com/documents/examples/xmlrpcclient.py), but glancing
at the code it doesn't support HTTP/1.1 persistent connections out of the
box... you could probably add that in relatively easily, though.

> You can see the results here:
> 
> http://cvs.sf.net/viewcvs.py/bitpim/bitpim/bitfling/xmlrpcstuff.py?view=markup

Glancing at that, it looks like using Twisted to implement that would be a
lot easier, and shorter.

-Andrew.





More information about the Python-list mailing list