Welcome to FastCGI4D

The project aims to provide D with a Tango-compatible FastCGI library. It is one possible solution for high-performance web pages or any other dynamic web content. It's licensed under a BSD-style license, see LibraryLicense.

News

Now the protocol implemenation can handle multiple name/value pairs in one header. Due to this change, lighttpd should now also work. Thanks to stack_overflow for the bug report.

I've removed a bug which made CGI applications (Thread/Application) run twice. Thanks to bobef for reporting it.

The recent changes to tango.io.Conduit are also reflected now. If you get errors about instantiation of abstract conduit classes, please update to latest revision.

If you find further bugs or have any other ideas, please let me know and create a ticket.

Downloads

The library code is available as fastcgi4d-current.zip, fastcgi4d-current.tar.gz or fastcgi4d-current.tar.bz2.
It is compatible to DMD 1.018 and Tango revision 2456.

Features of the library

First of all, the user benefits from all features of the FastCGI protocol itself. If you would like to know, why FastCGI is worth a try, take a look at the FastCGI docs. Additionally, this project should make it much more comfortable to use, than in other languages. Especially, there are the following features:

  • Access to the four fcgi streams via special Conduits.
  • Support for plain CGI via the standard Conduits.
  • Threading for high-load applications.
  • Optimized for performance, avoiding unnecessary allocations.
  • Normal D environment, even Exceptions work. Uncaught ones are reported to the server-log automatically.

Drawbacks / What the library does not do

  • The library does not provide you with techniques for creating the content, it only makes your application able to communicate with your web server via FastCGI.
  • As I'm not comfortable with programming on Windows, I decided to use the OS specific functions of the original FastCGI library, as they're really complex. Drawback is, that one must link his/her projects against the original libfcgi!

Current state

If you think about using it - take a look at UsageExamples and see, how easy it is to create applications. Currently, it's working for my Linux box - Windows is untested but hopefully works, too.

Future plans

  • Although threading already works, I'm thinking of a adaptive thread manager, which increases or decreases the number of threads, depending upon load.

Other projects for web development in D

  • Wombat - A framework for building CGI applications in D
  • DSP - A dynamic servlet generation toolkit, designed for web servers