[medusa] XML-RPC with a http server

Sam Rushing rushing@n...
Mon, 23 Apr 2001 09:33:05 -0700


Eugene Leitl wrote:

> There can be only one handler in the asyncore.loop(), correct? I can't
> run medusa serving web pages (applets, cgi-bin python) at one end, and
> have an xml-rpc running within the same binary, on an alternative port?

The 'handler' is an http_server-specific thing. You install multiple
'handlers' on the http server to map to different URI's. (they're usually
matched using a regular expression).

You can have as many different kinds of servers as you like running. I've
used servers that spoke 4 or 5 different protocols. The easiest way to do
that of course, is to have each one on a different port. 8^)

> Or can I have medusa serving html on, say, port 80, and the xml-rpc
> handler be automatically invoked, when a POST /RPC2 HTTP/1.0 request comes
> in on same standard port?

It should just work as you expect. Just call 'hs.install_handler' in
whatever order makes sense. The handlers are maintained in the order they
are installed, and they're tried in that order. This allows you to install a
'match-all' handler at the end of the chain.

Take a look at the 'match' method of the xmlrpc_handler...

-Sam