[mod_python] apache API and mod_python <-> protocol module integration

Gregory (Grisha) Trubetskoy grisha at modpython.org
Wed Jul 16 13:59:58 EST 2003

On Wed, 16 Jul 2003, Robert Sanderson wrote:

> > the basic idea is that apache2 by default accepts http like connections,
> > which aren't conducive to the synchronous communication of telnet..

There is an example of a simple echo module here:


> > keep-alive is vaguely similar but not good enough for the purposes of
> > allowing a telnet or pop/3 gateway
> Currently, as I found when implementing Z39.50, it's a real pain as
> there's no way to read in all available data, and if you try to read past
> the end of the available data the read will block.

This is not a problem of mod_python or Apache, this is the way sockets
work. If your protocol is such that you know ahead of time how much to
read (e.g. HTTP), then you can request this much data in one read.
Otherwise, you must read in smallest unit sizes of your protocol, which
(I'm guessing) is 1 byte in case of Z39.50.

> This makes it useless for something like (say) an IRC or MUD style
> server where there might be data flowing in either direction at any
> given time.  Mod_Perl on the other hand has a better system:
> http://perl.apache.org/docs/2.0/user/handlers/protocols.html

Mod_perl doesn't do it any differently (unless I'm missing something). I
don't think implementing an IRC or MUD server in mod_perl is going to be
any different.

BTW, if using Apache is not a requirement, then doing something like this
might be easier in twisted (twistedmatrix.com).


More information about the Mod_python mailing list