# SCGI Details

An SCGI server works like an HTTP server, except that the requests arrive in a special SCGI format. An SCGI request has a header followed by a body. The body can be any sequence of bytes, but the header has the following parts in this order:

1. an ASCII decimal string representation of an integer,
2. an ASCII colon character ":",
3. an even number of null-terminated strings of bytes,
4. an ASCII comma character ",".

## Additional requirements:

- The number at the beginning of the header tells the number of bytes in part 3) of the header.
- The number at the beginning of the header must not start with a "0".
- Part 3) is a sequence of field name-value pairs, where each name and each value is null-terminated.
- The "CONTENT_LENGTH" field name must always be present.
- There must be an "SCGI" field with a value of "1".
- Standard CGI environment variables should be included in the fields.
- No field name may appear twice.

DurusWorks Documentation