xmlprclib/server not reusing connections

Roger Binns rogerb at rogerbinns.com
Tue Feb 24 18:55:52 EST 2004


> > 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.
>
> if you don't like the xmlrpclib default Transport, use your own.  you probably
> only have to override 'make_connection' and 'parse_response' to get the be-
> haviour you're looking for.

Yes, I pointed at the code I had to write.  In particular I had to do the following:

 - My own Transport
 - reimplementation of parse_response method (existing one shuts down connection)
 - reimplementation of request method (existing one uses Python 1.5 httplib
   function names and semantics)
 - reimplementation of making a connection to reuse existing one if appropriate
 - My own handler
 - reimplementation of do_POST to get authentication headers (and not close
   connections)
 - reimplementation of finish to do proper SSL shutdown sequence
 - work around bug in M2Crypto makefile method that doesn't actually do a dup
   and breaks semantics if called twice

It isn't as simple as it would first appear, and the many layers of indirection
and sub-classing made it even harder to figure out what was going on, and to
override behaviour.

Roger





More information about the Python-list mailing list