cgi http server
1.0.0
中文|英语
CGI Web服务器的灵感来自Tiny-HTTPD,并使用第三方库, Libev , HTTP-Parser , Hashmap , log.c增强。它向您展示了Web服务器的工作方式。
1.安装libev和python3。
sudo apt install -y libev-dev python32.删除源代码。
git clone https://github.com/uncle-lv/cgi-http-server.git 3. Into the Directory src ,然后运行make编译代码。
make 4、运行CGI服务器(参数port是可选的)
./server {port}有几个用于测试的URL,
/index.html,/login.html和等。您应该执行CGI脚本的许可。
src
├── hashmap.c
├── hashmap.h
├── http_parser.c
├── http_parser.h
├── http_request.c
├── http_request.h
├── log.c
├── log.h
├── Makefile
├── server
└── server.c
如果要读取源代码,请重点关注http_request.*和server.c 。其他文件是第三方库。
Hashmap:在C中实现HashMap。
HTTP_PARSER:HTTP请求/响应解析器。
log.c:C99中实现的简单日志记录库。
期待任何问题或从您那里提取请求。
也许将来实现整个HTTP/1.0和CGI/1.1。
麻省理工学院