http://www.oschina.net/p/tinyhttpd
tinyhttpd是一个超轻量型Http Server,使用C语言开发,全部代码只有502行(包括注释),附带一个简单的Client,可以通过阅读这段代码理解一个 Http Server 的本质。
要在linux平台上运行,首先,按照作者的提示,注释掉一些东西:
This program compiles for Sparc Solaris 2.6.
* To compile for Linux:
* 1) Comment out the #include <pthread.h> line.
* 2) Comment out the line that defines the variable newthread.
* 3) Comment out the two lines that run pthread_create().
* 4) Uncomment the line that runs accept_request().
* 5) Remove -lsocket from the Makefile.
因为作者的cgi脚本用的是perl,所以要提前安装perl,并在cgi脚本里将perl的路径改成自己的路径。
然后,编译运行:

照这样输入:

提交后,显示颜色,服务器的功能测试完成。
