Project

General

Profile

SCGI Interface

Module: mod_scgi

Description

The SCGI module is heavily based on the FastCGI when it comes to configuration.

Only the internal protocol between server and client has been replaced.

Please check the documentation of the FastCGI module for more information.

History

Added in lighttpd 1.3.14 as it was really simple to do.

C/C++ SCGI on named socket

Up to lightty 1.4.19 there is a bug in that the pre-opened socket handle is not on descriptor 0 (as it is for FastCGI FCGI_LISTENSOCK_FILENO) but any later file descriptor.

Since 1.4.20 you can take over your testfastcgi program and replace FCGX_Accept() by a standard Unix accept(LISTENSOCK_FILENO, &addr, &addrlen) - then pthread_create/fork for your handler.

The SCGI parameter block at the start of the socket stream is easy to read and to decode - no third-party library is required anymore.

Just write() to the accept'ed socket handle to return the result page to the lightty webserver and close() the accept'ed handle to signal that the request has finished.