Just some random notes:

- FastCGI requires the global use of FastCGI drop-in replacements for read/write calls. ALL code using the friends APIs must use the FastCGI replacements.

- The FastCGI wrapper for fwrite() has a broken type signature, possibly requiring a kludge in the client code:

#  define FWRITE(p, s, n, f) FCGI_fwrite((void *)p, s, n, f)

FCGI_fwrite() is defined to take a _non-const_ pointer as the src memory address, which is incompatible with fwrite() and breaks code which references fwrite via function pointer.

Additionally, FastCGI requires per-app-run state, which fossil's architecture cannot handle (it makes heavy use of global state). That said, DRH once suggested the fork()ing each instance as a workaround. The cost of fork()ing _might_, however, be as high as _not_ using FastCGI.