谁有Go写的FCGI的例子吗?

234 views
Skip to first unread message

Yang

unread,
Apr 17, 2012, 8:40:09 AM4/17/12
to golang-china

或者说CGI的例子可能共享的?想学习一下。(GoFCGI支持不完整吧?我不懂,学习中)

谢过!

 

--斧头

Monnand

unread,
Apr 17, 2012, 2:39:26 PM4/17/12
to golang...@googlegroups.com

标准库里好像有。手机码字,不负责任建议…

--
官网: http://golang-china.org/
IRC: irc.freenode.net #golang-china
@golangchina

Hoping White

unread,
Apr 17, 2012, 9:56:44 PM4/17/12
to golang...@googlegroups.com

使用上与普通http没区别,只用调用

fcgi.Serve而已,cgi只是一个壳

斧头

unread,
Apr 17, 2012, 11:22:16 PM4/17/12
to golang-china
嗯,就是这点,弄得我这个初学者很晕,所以想找个例子看一看。
--------------
斧头

Wenqiang Song

unread,
Apr 18, 2012, 12:11:04 AM4/18/12
to golang...@googlegroups.com
git://github.com/hoisie/web.git
Web.go支持fcgi

2012/4/18 斧头 <awu...@gmail.com>

斧头

unread,
Apr 18, 2012, 1:53:20 AM4/18/12
to golang-china
多谢!
看了一下这个,还是没能满足我的一些想法/问题。。。。

比如,我想知道,Go写的东西,能不能以下面这种模式工作:

client <----------> HTTP Server (Nginx/Apache) <------------------->Go CGI Program

如果可以的话,Go是怎么和HTTP Server通信的?

单看Go自己的文档,我感觉Go的CGI只支持Go自己写的Server似的,是这样吗?


--------------
斧头

minux

unread,
Apr 18, 2012, 2:29:46 AM4/18/12
to golang...@googlegroups.com

2012/4/18 斧头 <awu...@gmail.com>

比如,我想知道,Go写的东西,能不能以下面这种模式工作:

client <----------> HTTP Server (Nginx/Apache) <------------------->Go CGI Program
当然可以 net/http/fcgi 就是把Go程序作为FastCGI的backend而已,和配置php fastcgi
backend是一样的。
 
如果可以的话,Go是怎么和HTTP Server通信的?
通过fcgi协议,看net/http/fcgi的文档,里面有链接。 

单看Go自己的文档,我感觉Go的CGI只支持Go自己写的Server似的,是这样吗?
不是这样的。 (传统的)CGI就是一个程序,当HTTP请求来了的时候,web server
运行那个程序,把http请求给那个程序的stdin,那个程序的stdout就是http回应。

用Go写CGI程序,跟web server用什么是完全无关的。

Asta Xie

unread,
Apr 18, 2012, 2:30:16 AM4/18/12
to golang...@googlegroups.com
https://github.com/shellex/Tattoo 

看他写的readme,配置和实现都有

斧头

unread,
Apr 18, 2012, 2:38:23 AM4/18/12
to golang-china
谢谢minux
这正是我想要的!
cgi相关的东西我也是刚刚接触,所以问的问题比较傻,你跟我举例php啥的就对牛弹琴了,嘿嘿,见笑
--------------
斧头

斧头

unread,
Apr 18, 2012, 2:39:15 AM4/18/12
to golang-china
这个赞, 我要好好读一下。
--------------
斧头

q

unread,
Apr 18, 2012, 9:07:35 PM4/18/12
to golang...@googlegroups.com
这个我是这样想的,按照go的http包,大概就知道http/fcgi这个是怎么用了;
所谓http和fcgi只是client与server请求和应答的协议,client就是你所谓的apache或者nginx,而server就是
func Serve(l net.Listener, handler http.Handler) error 建立的,后面需要处理的数据参照fastcgi协议的参数就行了。
不知道我说的对不对。
Reply all
Reply to author
Forward
0 new messages