This is a Gauche extension module to use FastCGI.

[Requirements]

- Gauche (http://practical-scheme.net/gauche/)  0.8.3 or later
- FastCGI Development Kit (http://www.fastcgi.com/)

[Building]

  % ./configure
  % make
  % make install

If you have installed FastCGI Development Kit (libfcgi etc) in
non-standard place, you have to tell so to the configure script
by --with-fcgi option, for example:

  % ./configure --with-fcgi=/opt/extra

In this example, the build process will look for libfcgi header
files in /opt/extra/include, and libfcgi library from /opt/extra/lib.


[Usage]

Gauche-fastcgi is an extension module to write FastCGI applications.
Current version of this module provides only one useful function:
with-fastcgi.

Function: with-fastcgi thunk

This function repeats the following processes eternally.

1. Accept the request via FastCGI protocol
2. Set the current input/output/error ports and cgi-metavariables properly
3. Call thunk

By wrapping around with-fastcgi, CGI scripts are easily turned into
FastCGI applications.  FastCGI'd scripts are persistent and do not
create process per request.  In short, your CGI scripts can be boosted
by using with-fastcgi.

The following script is a FastCGI-ized version of the example shown in
the Gauche Reference Manual. This can also be run as a normal CGI
script.

(use text.html-lite)
(use www.cgi)
(use www.fastcgi)

(define (main args)
  (with-fastcgi
    (lambda ()
      (cgi-main
       (lambda (params)
         `(,(cgi-header)
           ,(html-doctype)
           ,(html:html
             (html:head (html:title "Example"))
             (html:body
              (html:table
               :border 1
               (html:tr (html:th "Name") (html:th "Value"))
               (map (lambda (p)
                      (html:tr
                       (html:td (html-escape-string (car p)))
                       (html:td (html-escape-string (x->string (cdr p))))))
                    params))))
           ))))))


Also look at sample.fcgi in the source directory.  Copy it to
wherever your httpd can recognize the CGI script, and it can be
used to check fcgi mechanism is working properly.


