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

fitnah55 fitnah55 at hotmail.com
Wed Jul 16 17:00:43 EST 2003


hey..

how do i get the connectionhandler to work properly under a virtual host
and/or
just for a particular port?

everything is running off of a single IP address through about 5 domains
and 20 virtual hosts..

i need telnet access potentially across all of the hosts

all of this from the single application framework




> -----Original Message-----
> From: Gregory (Grisha) Trubetskoy [mailto:grisha at modpython.org] 
> Sent: Wednesday, July 16, 2003 2:00 PM
> To: Robert Sanderson
> Cc: k d; mod_python at modpython.org
> Subject: Re: [mod_python] apache API and mod_python <-> 
> protocol module integration
> 
> 
> 
> 
> 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:
> 
http://www.modpython.org/live/current/doc-html/pyapi-conn.html

> > 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).

Grisha


More information about the Mod_python mailing list