Home
Name Modified Size InfoDownloads / Week
libscgi-0.4.tar.gz 2012-06-21 345.6 kB
README 2012-06-21 3.4 kB
libscgi-0.3.tar.gz 2012-01-09 307.2 kB
Totals: 3 Items   656.1 kB 0
This library provides parsing of Simple Common Gateway Interface (SCGI) 
requests. 

SCGI is a protocol for applications to interface with HTTP servers, as an 
alternative to the CGI protocol. It is similar to FastCGI, but designed to be 
easier to implement. 

Web servers which implement SCGI include Apache HTTP Server, Lighttpd, and 
Cherokee, as well as Mathopd (with unofficial patch) and nginx (with a third 
party module). 

When using this library, the developer chooses a SCGI server implementation; 
the library simply facilitates validating and parsing the request submitted by 
the client to the server.

Code using the 0.3 version is not compatible with the 0.4 version, since the
protoypes for the scgi_load_fd and scgi_load_file functions have changed.

A demonstration server is included. It displays all the headers submitted by
your web server and their values to aid in developing other servers. For
example, once the SCGI server and web server are both running, one can
execute:

curl -i -X GET http://127.0.0.1/demo.scgi

to have these printed to standard output.

When the tarball has been unpacked, you will see (in addition to all the
Autotools and Doxygen files) the following files and directories:

libscgi-<PACKAGE-VERSION>/include/  (1)
libscgi-<PACKAGE-VERSION>/include/scgi.h  (2)

This directory (1) holds the header file (2) to include when using the library
and is stored in the appropriate system directory by the install make target.

libscgi-<PACKAGE-VERSION>/lib/  (3)
libscgi-<PACKAGE-VERSION>/lib/scgi.c  (4)

This directory (3) holds the source code (4) for the library. The compiled
code is stored in the appropriate system directory by the make install target.

libscgi-<PACKAGE-VERSION>/src/  (5)
libscgi-<PACKAGE-VERSION>/src/handler.h  (6)
libscgi-<PACKAGE-VERSION>/src/handler.c  (7)
libscgi-<PACKAGE-VERSION>/src/main.c  (8)

This directory (5) contains files for the demo server. The demo server is
not installed by the install make target. The skeleton of the server is in
main.c (8), which you should not alter except to add initialization and
clean-up code. See the comments within. It uses the header file handler.h
(6) and uses the function read_and_respond_to_client(int filedes) in
handle.c (7) to respond to the request. If you want to use this in your
project, replace the code in handler.c with your code

libscgi-<PACKAGE-VERSION>/tests/  (9)

This directory (9) holds unit-tests which use the Autotools shell script
testing framework which are executed by the check make target.

Note that the headers portion of the SCGI request is limited to 4096 bytes
to prevent the possibility of a maliciously-crafted request that creates a
buffer over-run. See last paragraph regarding request body length.

To install:

./configure
make
(optionally) make check
(optionally) make doxygen-doc
make install

Although configuring Lighttpd to use SCGI is beyond the scope of this README,
hints from /etc/lighttpd/lighttpd.conf are enclosed below.

server.modules = (
  ...,
  "mod_scgi",
  ...)

scgi.server = ( ".scgi" =>
  ( "scgi-tcp" =>
    (
      "host" => "127.0.0.1",
      "port" => <PORT SCGI SERVER LISTENS ON>,
      "check-local" => "disable",
    )
  )
)

And the following is for allowing the webserver to access the SCGI server
via the network under Fedora with SELinux in enforcing mode:

su -c 'setsebool -P httpd_can_network_connect 1'

Source: README, updated 2012-06-21