CGIHTTPServer

Laurence Tratt tratt at dcs.kcl.ac.uk
Fri Oct 29 12:20:53 EDT 1999


In message <Pine.LNX.3.91.991029082821.15131H-100000 at amati.techno.com>
          Paul <prescod at prescod.net> wrote:

> Does forking make sense for CGIHTTPServer or should it really be using
> threads?

This really depends on what you want to do. If you want to implement
"traditional" CGI scripts (as CGIHHTPServer is set up to do by default),
then forking is arguably the best way to do it under Unix; if you are
fortunate enough to be able to write more advanced CGI-esque functions, then
threading tends to be a more reasonable way of doing things in my
experience.

For a project I was doing a few months ago, I hacked the *HTTPServer
libraries[0] into a forking / threading hybrid, which allowed me to keep
some of the system I was on as standard CGI scripts but use threading for
some performance critical stuff which also needed to access a central data
repository. Once I'd made a few additions to the libraries for things like
http://host/dir -> http://host/dir/ redirection and made it recover from /
accept errors where it needed to, I actually wound up with a surprisingly
useful, resilient web server for quite a specialised task in a short space
of time.


Laurie

[0] Along with a couple of bodges to SocketServer <wink>
-- 
http://eh.org/~laurie/comp/python/




More information about the Python-list mailing list