FastCGI connector.
Remark: This connector does not allow requests to be multiplexed (and let it know to the web server via FCGI_MPXS_CONNS=0). Multiplexing requests is seldom done by FastCGI modules and is even sometimes impossible because of bugs in them. Moreover, multiplexing is mostly useful if concurrent requests are handled by different threads while this library use a single thread to process all requests coming on a given connection. If the need is felt (speak out!), a multithreaded connector can be built on the side of this one.
A FastCGI application can fulfill each of the following three roles:
`Responder
: This is the usual role. In this case the
application is expected to act like a CGI program: It receives
all the information associated with an HTTP request and
generates an HTTP response.`Authorizer
: An Authorizer FastCGI application receives
all the information associated with an HTTP request and
generates an authorized/unauthorized decision.`Filter
: A Filter FastCGI application receives all the
information associated with an HTTP request, plus an extra
stream of data from a file stored on the Web server, and
generates a "filtered" version of the data stream as an HTTP
response.This the the channel on which the filter data is available.
All methods of the object raise Netchannels.Closed_channel
if the role is not `Filter
.
How many bytes of the data are available.
The data last modification time, expressed as an integer number of seconds since the epoch (January 1, 1970 UTC).
run f
register the function f
as a main function of the
script. Each call to the script will execute f cgi
. The code
outside f
will be executed only once (when the script is
loaded into memory) which allows to cache database connections,
etc.
`Direct ""
`Automatic
for all arguments.
sockaddr
to the address the web
server needs to connect to to talk to the script (this address
must also be specified in the wen server config file).
sockaddr
listening to
localhost only. If you would like your FastCGI program to
be accessed from a different machine, use sockaddr
instead.handle_request config output_type arg_store eh f ~max_conns
~log fd
: This is a lower-level interface that processes
exactly one request arriving on the existing connection fd
.
max_conns
is passed to the FCGI client and indicates how many
connections this server can process in parallel.
log
is the error logger function or None
, in which case
errors are passed through to the FCGI client.
The other arguments are just like for run
.
The return value indicates whether the connection can be kept open or must be closed.