Simple Common Gateway Interface

from Wikipedia, the free encyclopedia

The Simple Common Gateway Interface ( SCGI ) is a text-based network protocol for connecting an application server to a web server . It is an alternative to HTTP and the classic CGI and is similar to the FastCGI protocol.

The specification was created by Neil Schemenauer and published as a public domain specification on January 12, 2006. Compared to FastCGI, the SCGI protocol is easier to implement; Modern web servers meanwhile offer support for FastCGI and SCGI alike.

Protocol description

Each SCGI Request ( Engl. Request) consists of a list of headers (description of content) and a body (content). The headers are encoded as a net string and then sent to the SCGI application via a separate connection, followed by the body. The connection remains in place and is only terminated after the SCGI application has sent a response.

By coding the headers as a net string, each SCGI request begins with a number. Since this therefore begins with an ASCII byte between '1' and '9', it can be differentiated from an HTTP forward - a running SCGI application can easily be put into the position of both SCGI requests and HTTP GET / POST - Handle inquiries.

No format is defined in the protocol for the response. However, as with CGI, it is common for the response to begin with the status parameter.

Header

<Key> <NUL> <Value> <NUL>

As shown above each header is composed of a key-value pair ( engl. Key-value pair). The key is separated from the value with an ASCII zero (NUL) and the header is terminated with an ASCII zero (NUL). Each key must be unique and can therefore only appear once.

SCGI request

<Length of the net string>: "CONTENT_LENGTH" <NUL> <Length of the body> <NUL> "SCGI" <NUL> 1 <NUL> ... "," <Body>

The first header must have the key "CONTENT_LENGTH" and must not have an empty value, even if the length of the body is 0. This is followed by all the other headers, which are optional with the exception of one with the key "SCGI" and value 1.

Web server support

The following web servers support the SCGI protocol.

Language connection

The following programming languages ​​support the creation of SCGI applications via language connection :

Individual evidence

  1. SCGI specification, § 2

Web links