Integrating SimpleHTTPServer into asyncore

Panu A Kalliokoski pkalliok at cc.helsinki.fi
Wed Jul 11 16:11:10 EDT 2001


Ng Pheng Siong <ngps at madcap.dyndns.org> wrote:

> In your opinion, how much effort does it take to shoehorn, um, integrate
> Medusa's HTTP/1.1 implementation into your framework? 

It depends. I haven't checked Medusa's code, but if it's done in a
sensible way (i.e. protocol handlers are separate objects from
socket/channel handlers), it should be at most a 15-minute job. Where
could I get the Medusa source to try it out?

Is Medusa built on asyncore/asynchat? I've changed two asyncore/asynchat 
based programs to Selecting-based ones in less than one hour.

> Alternatively, what is the best way to get a HTTP/1.1 implementation
> running on your framework?

Well, HTTP is a quite line-oriented protocol, so TCPServer's default
channel handler (buffered line-oriented protocol much like asynchat) is
good for the task.  Writing an HTTP implementation involves basically
writing a protocol handler, which is an object with a method
receive(self,data) to be called upon reception of a whole line.

So the API is very simple. Writing a HTTP/1.1 protocol handler is not, but
I presume Medusa has one already?

Panu




More information about the Python-list mailing list