FastCGI、SCGI、
我正在用 C 语言编写一个 Web 服务器,我需要找到一种使用 CGI 在服务器端执行动态内容的方法。
我正在查看 FastCGI 协议,它看起来令人讨厌。它让我想起了我在课堂上将 ASCII 转换为 UTF-8 并转换回来时必须做的一些事情(当时看起来没用,但也许不是……)
我发现了一个用 PHP 编写的很棒的库,其中我可以启动 php-cgi -b localhost:8888 并开始与其通信。显然,我希望用 C 语言实现这一点。
如果有人能找到一个库(针对 FastCGI 客户端!),我将不胜感激。如果没有,那么我很乐意通过编写一个来为开源社区做出贡献。
另外,我到底如何使用SCGI?几乎没有任何关于它的文档(无论如何我都能找到)。我连接到什么插座?我应该将请求发送到哪里?
另外,php-cgi
仅适用于 PHP,那么 Perl、Python 等如何工作呢?
再次感谢。
I'm writing a web server in C, and I need to figure out a way to use CGI to execute dynamic content server-side.
I'm looking at the FastCGI protocol and it looks annoying. It reminds me of the bit twiddling I had to do in a class when I was converting ASCII to UTF-8 and back (that seemed useless then, but maybe it wasn't...)
I found a great library written in PHP where I could just start up php-cgi -b localhost:8888
and start communicating with it. Obviously, I'd like that in C.
I'd appreciate it if someone could find a library (for FastCGI clients!). If not, then I'm fine with contributing to the open source community by writing one.
Also, how exactly do I use SCGI? There's barely any documentation on it (that I can find, anyway). What socket do I connect to? Where do I send the requests?
Also, php-cgi
is only for PHP, so how do things work for Perl, Python, etc?
Thanks again.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
mario 说(在问题评论中):
对此我想补充一点:CGI(这正是问题所要求的)在其工作模型中与 FCGI 和 SCGI 不同。很容易将一个人误认为其他人。幸运的是,Preetam 似乎要求使用 FCGI 和 SCGI。
mario said (in the question comments):
To this I'd like to add: CGI (which is exactly what the question asks for) is different from FCGI and SCGI in their working models. It's quite easy to mistake one for others. Luckily, it seems like Preetam asked for FCGI and SCGI.