Igor Sysoev ha scritto:
On Wed, May 14, 2008 at 09:51:11AM +0200, Manlio Perillo wrote:
By the way, if someone is interested I'm starting to write a CGI module
(and, of course, in a very non orthodox way)!
How do you want to implement it ? Forking entire worker it seems overkill
for me: you need to close all connections or use FD_CLOEXEC for every
socket/etc.
Yes, this is one of the main problems.
But it is not stricly necessary to close all the opened connections.
The open syscall should return a file descriptor that is the lowest file
descriptor not currently open for that process, so maybe it is safe to
just close the first 256 descriptors.
Of course there should be a timer that make sure to close the child
process when it timeouts, to avoid a CGI program to stay alive for too
much time.
Right, it will always be the same as proxying to an external http
server, but the advantage is that all can be done without having to use
external servers.
Moreover, since I'm mainly a Python programmer, I will try to implement
special support for executing Python CGIs without having to to call exec.