What is scgi

Source: Internet
Author: User

Http://blog.csdn.net/ablo_zhou
SCGI (Simple Common gateway Interface). is a CGI alternative protocol, similar to fastcgi, but simpler. The test scgi implementations are more efficient and more stable than CGI and fastcgi. scgi, like CGI, is divided into both the client and the server side. The client is placed on the HTTP server side. If Apache has mod_scgi,lighthttpd, there is built-in scgi support. Currently (2008.12.29) the latest version of scgi 1.13, the server implementation is Python, but put on the HTTP server side of the client implementation is C language.
Standard Original: In the Http://python.ca/scgi/protocol.txt protocol, ASCII characters can be represented by a 16-digit number enclosed in < > and can be enclosed in quotes "". The message consists of a header and a report body. Header format:

     Headers:: = header*
        Header:: = name NUL value NUL
        name:: = notnull+                
        value:: = notnull* notnull
        :: = <01& gt; | <02> | <03> | ... | <ff>
        NUL = <00>

Duplicate naming is not allowed in the header. The first header must be named "Content_length",
And its value is non-empty ASCII numeral sequence, the length of the message body is given in decimal number form.
The "Content_length" header must always exist, even if its value is "0".
At the same time must always be known as "scgi" with a value of "1" header.
To facilitate migration from CGI, standard CGI environment variables should be provided as scgi headers.

The header uses netstring encoding. The format is an example of an "entire message length string: header, Body," as follows:
The Web server (a scgi client) opens a connection, sending a concatenation of the following strings:

"70:"
"Content_length" <00> "a" <00>
"scgi" <00> "1" <00>
"Request_method" <00> "POST" <00>
"Request_uri" <00> "/deepthought" <00>
","
"What is the" answer to life?

This is a netstring encoded header + report body. The first 70 indicates a message length of 70 8 bits. <00> A string that represents the end of 0. Use "," to separate headers and reports.
The SCGI server sends the following response:

"status:200 OK" <0d 0a>
"Content-type:text/plain" <0d 0a>
"" <0d 0a>
"42"

<0d 0a> indicates a newline.
The SCGI server closes the connection.

Reference: Http://python.ca/scgi/protocol.txt
Chinese translation: http://blog.chinaunix.net/u1/57558/showart_1270846.html
http://python.ca/scgi/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.