*** Welcome to piglix ***

Simple Common Gateway Interface


The Simple Common Gateway Interface (SCGI) is a protocol for applications to interface with servers, as an alternative to the CGI protocol. It is similar to FastCGI but is designed to be easier to implement and crucially, permits CGI operations where the CGI operation has significant latency (e.g. contacting an external database).

The client connects to a SCGI server over a reliable stream protocol allowing transmission of 8-bit bytes. The client begins by sending a request. When the SCGI server sees the end of the request it sends back a response and closes the connection. The format of the response is not specified by this protocol.

A request consists of a number of headers and a body. The format of the headers is:

Duplicate names are not allowed in the headers. The first header must have the name "CONTENT_LENGTH" and a value that is the length of the body in decimal. The "CONTENT_LENGTH" header must always be present, even if its value is "0". There must also always be a header with the name "SCGI" and a value of "1". In order to facilitate the transition from CGI, standard CGI environment variables should be provided as SCGI headers.

The headers are sent to the server application encoded as a netstring. The body is sent following the headers and its length is specified by the "CONTENT_LENGTH" header.

The web server (an SCGI client) opens a connection and sends the concatenation of the following strings:

The web application (SCGI server) sends the following response:

The SCGI server then closes the connection.


...
Wikipedia

...