Wikipedia:

Simple Common Gateway Interface

Simple Common Gateway Interface (SCGI) — a protocol for applications to interface with HTTP servers, an alternative to the CGI protocol. It is similar to FastCGI but is designed to be easier to implement.

The specification document was placed in the public domain by Neil Schemenauer <nas@python.ca> on 12 January, 2006.

Specification

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. See below for the format of the 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.

Request Format

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

        headers ::= header*
        header ::= name NUL value NUL
        name ::= notnull+                
        value ::= notnull+
        notnull ::= <01> | <02> | <03> | ... | <ff>
        NUL = <00>

Duplicate names are not allowed in the headers. The first header must have the name "CONTENT_LENGTH" and a value that is a nonempty sequence of ASCII digits giving 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 encoded as a netstring. The body is sent following the headers and its length is specified by the "CONTENT_LENGTH" header.

Example

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

        "70:"
            "CONTENT_LENGTH" <00> "27" <00>
            "SCGI" <00> "1" <00>
            "REQUEST_METHOD" <00> "POST" <00>
            "REQUEST_URI" <00> "/deepthought" <00>
        ","
        "What is the answer to life?"

The SCGI server sends the following response:

        "Status: 200 OK" <0d 0a>
        "Content-Type: text/plain" <0d 0a>
        "" <0d 0a>
        "42"

The SCGI server closes the connection.

External links


 
 
 

Join the WikiAnswers Q&A community. Post a question or answer questions about "Simple Common Gateway Interface" at WikiAnswers.

 

Copyrights:

Wikipedia. This article is licensed under the GNU Free Documentation License. It uses material from the Wikipedia article "Simple Common Gateway Interface" Read more

Search for answers directly from your browser with the FREE Answers.com Toolbar!  
Click here to download now. 

Get Answers your way! Check out all our free tools and products.

On this page:   E-mail   print Print  Link  

 

Keep Reading

Mentioned In: