You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rob Hartill <ha...@hyperreal.com> on 1995/12/09 22:17:45 UTC

Apache with embedded Python interpreter (fwd)

I told the submitter that if anyone is interested in this then one
of you will contact him.


Forwarded message:
> From skip@automatrix.com  Fri Dec  8 22:46:46 1995
> Date: Sat, 9 Dec 1995 01:46:32 -0500
> From: Skip Montanaro <sk...@automatrix.com>
> Message-Id: <19...@dolphin.automatrix.com>
> To: apache-bugs@mail.apache.org
> Subject: Apache with embedded Python interpreter
> Reply-to: skip@calendar.com (Skip Montanaro)
> 
> 
> It's quite easy to embed a Python interpreter (http://www.python.org/) in
> Apache by modifying the cgi_child() function in mod_cgi.c.  Dave Mitchell at
> magnet.com did this recently.  This avoids the exec call, but unfortunately
> doesn't avoid the fork call.  It's not clear to me just what all has to be
> done to set things up for the interpreter so I can invoke it before the call
> to spawn_child in cgi_handler.
> 
> Is it sufficient to set up the environment variables and provide someplace
> for the CGI script to read stdin and dump stdout?  It looks like POST/PUT
> input for the script is in a buffer waiting to toss at the script and that
> all script output is just shuffled off to the client connection (modulo any
> Location: headers).
> 
> What I'm trying to do may not be entirely feasible since CGI scripts are
> designed to write to stdout and read from stdin.  However, Python does have
> a StringIO class that can suffice for most uses of stdin and stdout.  I can
> set up instances of StringIO in place of the script's stdin and stdout
> before invoking the interpreter, then read and process their contents after
> the script completes execution.
> 
> Any feedback appreciated.
> 
> Skip Montanaro		skip@calendar.com			  (518)372-5583
> Musi-Cal: http://www.calendar.com/concerts/ or mailto:concerts@calendar.com
> Internet Conference Calendar: http://www.calendar.com/conferences/
> 	       >>> ZLDF: http://www.netresponse.com/zldf <<<
>