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。
麻省理工學院