[摘]什么是scgi
关键字: python scgi fcgiSpecification
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> | ... |
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.
相关:什么是FastCGI
1. FastCGI 像是一个常驻 (long-live) 型的 CGI,它可以一直执行着,只要激活后,不会每次都要花费时间去 fork 一次 (这是 CGI 最为人诟病的 fork-and-execute 模式)。
2. FastCGI 可在任何平台上使用,Netscape Enterprise 及 IIS 都有 FastCGI 的模块可供使用,阿帕契 (Apache,以及利用 Apache 衍生出做的服务器) 上也有 mod_fastcgi 可用。
3. FastCGI 支持 C/C++,Ruby, Perl,Tcl,Java,Python 等程序语言。
4. FastCGI 的应用程序亦兼容于 CGI。即 FastCGI 的应用程序也可以当成 CGI 来执行。
5. 现有的 CGI 程序要改写成 FastCGI 非常简单,最少可能只需要多加入三行程序代码。
6. FastCGI 的侦错方式与 CGI 大同小异,只要带入程序所需的环境变量及参数,即可在命令列模式执行或侦错。
7. FastCGI 应用程序的写作方式与 CGI 类似,除了几项原则要特别注意外,FastCGI 的写作方式跟 CGI 几乎一样,与学习 Web Server API 比较起来, FastCGI 简单多了。
8. FastCGI 支授分布式运算 (distributed computing),即 FastCGI 程序可以在网站服务器以外的主机上执行并且接受来自其它网站服务器来的请求。
发表评论
- 浏览: 15256 次
- 性别:


- 详细资料
搜索本博客
我的相册
共 6 张
最近加入圈子
最新评论
-
无意中网上看到一篇关于ge ...
姜太公 写道可惜它的给关键字等加的颜色太难看。还有很多重复的gedit失败的地方 ...
-- by seen -
无意中网上看到一篇关于ge ...
可惜它的给关键字等加的颜色太难看。还有很多重复的
-- by 姜太公 -
无意中网上看到一篇关于ge ...
看到了,真不错阿
-- by theone -
关于Python和Java结合的新 ...
认同楼主的意见。如果有遗留系统,将其功能封装起来对系统新的部分提供服务,是比较稳 ...
-- by cloudeye -
关于Python和Java结合的新 ...
就这么个简单的功能还搞上ICE了?管道,标准IO通讯也成
-- by dennis_zane






评论排行榜