SCGI与FastCGI相似,也是CGI的一个替代协议,但是与FastCGI相比,SCGI更容易实现。
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> | ... |
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 程序可以在网站服务器以外的主机上执行并且接受来自其它网站服务器来的请求。
分享到:
相关推荐
epoll scgi server python 源代码 含实例, 源代码
该库提供了对简单公共网关接口(SCGI)请求的解析。 SCGI是一种应用程序与HTTP服务器接口的协议,是CGI协议的替代协议。 它类似于FastCGI,但设计为易于实现。 实现SCGI的Web服务器包括Apache HTTP Server,Lighttpd...
isapi-scgi:从https:sourceforge.netprojectsisapi-scgi迁移
#ScgiClient 用于 node.js node.js 的另一个 scgi 客户端模块。 与scgi-client相比,这个模块确实有更多的功能,但不能配置那么多。 它应该有更好的性能,但我还没有对其进行基准测试。 ##例子简单的例子: 有一个...
ISAPI SCGI扩展将对SCGI协议的支持添加到了Microsoft的Internet Information Server。 该扩展将多线程与I / O完成端口一起使用,以最大程度地减少内存和CPU使用率。
资源来自pypi官网。 资源全名:scgi-2.1.tar.gz
轻木SCGI 一个简单的 SCGI 侦听器,一个简单的线程阻塞 IO SCGI 服务器,可能对其他人有用。执照Balsa SCGI 版权所有 (c) 2012,Chris Ellis 保留所有权利。 如果满足以下条件,则允许以源代码和二进制形式重新分发...
Mr_SCGI 是一个轻量级库,它为用 C 编写的基于 Web 的应用程序提供 SCGI 服务器功能。它为请求检查、会话管理、cookie 和内存管理等设施提供了一个 servlet 容器样式的 API。
cscgi :C 的流式 SCGI 请求解析器。 作者: 安德烈·卡隆 接触: 描述 这个库为请求提供了一个解析器。 解析器作为有限状态机 (FSM) 实现,用于流应用程序(即数据以不可预测的速率到达并且解析器必须是可中断的...
名称Plack::Handler::AnyEvent::SCGI - AnyEvent::SCGI 上的 PSGI 处理程序概要 plackup -s AnyEvent::SCGI --port 22222描述Plack::Handler::AnyEvent::SCGI 是一个独立的 SCGI 守护进程,运行在。作者宫彦执照这个...
在Quixote官方白皮书中...使用Apache SCGI module scgi_mod将遵循SCGI协议Apache将请求发送到相应的Socket如localhost:3001。而这个Socket由本地运行的一个 Python程序打开。这个Python程序将处理请求,并返回结果。
关于proxy_store 的这个模块 | fastcgi_store | scgi_store | uwsgi_store 扩展,提供多个目录来动态存储和添加或删除目录。 (动态添加目录需要提前创建,目录权限必须是worker可以访问。)要求安装./configure --...
xxm ... 该项目被编译成一个模块,以供Internet Explorer中的可插拔协议处理程序,ISAPI扩展,带有HTTPAPI,带有CGI或SCGI的Apache模块或独立的HTTP服务器使用。...SCGI服务器进程 ...(也许以后再说) 大多数处理
用于几种常见直线,曲线,区域填充,以及图形消隐等
nginx的64位版本。 编译参数: auto/configure --with-cc=cl ...scgi_temp --with-cc-opt=-DFD_SETSIZE=1024 --with-http_ssl_module --with-select_module --with-openssl=openssl --with-pcre=pcre --with-zlib=zlib
迅捷SCGI 用Swift编写的服务器。 SCGI允许任何支持它的Web服务器与外部程序交互。 在这种情况下,是用Swift编写的程序。 这为使用Swift编写Web应用程序以及与任何支持SCGI的流行Web服务器(例如 , 和交互提供了...
ngx_cache_purge 是 nginx 模块,此模块可以清理 nginx 的 FastCGI、proxy、 SCGI 和 uWSGI 的缓存。配置指令(相同位置语法)fastcgi_cache_purgesyntax: fastcgi_cache_purge on|off|<method> [from all|<ip> [.....
Cherokee 是一个非常快速,灵活和轻便的Web服务器。它是用C语言编写。Cherokee 支持 FastCGI、SCGI、PHP、CGI、TLS 及 SSL 加密连接,虚拟主机,授权认证,实时编码,载入均衡,与 Apache 兼容的 log 文件等等。
ngx_zeromq, 针对 Nginx的ZeroMQ传输 ngx_zeromq 是一个传输模块,它允许 nginx 在与上游服务器通信时使用面向ZeroMQ的传输层。它是 7层协议不可知的,这意味着它可以与任何性能...proxy,fastcgi,uwsgi,scgi,等等 )
ngx_http_uwsgi_module and ngx_http_scgi_module. *) Bugfix: in virtual servers handling with SNI. *) Bugfix: new sessions were not always stored if the "ssl_session_cache shared" directive was used...