Scgid
is a program serving scgi requests (as issued by web servers) on tcp connections. Multiple tcp addresses can be specified in
file,
the configuration file. For each address, a program to handle the requests must be specified. At startup, all addresses are announced to. On the first use of a connection/program, its module (dis code) is loaded. Programs must adhere to the same module declaration as shell commands.
Options
-d
Print debugging output.
-v
Be verbose, this prints exceptions when thrown, and timing statistics.
-n nthreads
Set the number of threads to keep around.
Config file
File
is the config file. Leading whitespace of lines is stripped.
Empty lines are ignored, as are lines starting with a ``#''. Lines contain at least two fields:
addr
and
modpath.
The other tokens are passed to the program as arguments.
Addr
is the address
scgid
will
listen on.
Modpath
should be a normal dis program.
A single module
instance is used for all requests, so a module should not keep state.
Function
init
is called to handle a requests, just as the shell does for any other program.
Typically,
init
checks if modules have been loaded yet and does so if not. This prevents
reloading modules for each request.
Scgid
checks whether modules have changed before using them. If they
have, they are loaded anew. This allows for easy testing of a module
without having to restart the scgid all the time, while not having to
reload the module all the time. Note that library modules used by the
called program will also not be updated.
EXAMPLE
To let
scgid
serve the program testscgi on localhost, port 4006: