{"id":15786874,"url":"https://github.com/uncle-lv/cgi-http-server","last_synced_at":"2025-03-31T17:29:00.366Z","repository":{"id":58785815,"uuid":"530168985","full_name":"uncle-lv/cgi-http-server","owner":"uncle-lv","description":"a simple cgi HTTP server","archived":false,"fork":false,"pushed_at":"2022-09-15T14:29:41.000Z","size":96,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-11T21:32:35.743Z","etag":null,"topics":["cgi","http","http-server"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uncle-lv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-29T10:25:48.000Z","updated_at":"2022-09-15T11:49:03.000Z","dependencies_parsed_at":"2023-01-18T09:01:27.068Z","dependency_job_id":null,"html_url":"https://github.com/uncle-lv/cgi-http-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uncle-lv%2Fcgi-http-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uncle-lv%2Fcgi-http-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uncle-lv%2Fcgi-http-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uncle-lv%2Fcgi-http-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uncle-lv","download_url":"https://codeload.github.com/uncle-lv/cgi-http-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246508327,"owners_count":20788974,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cgi","http","http-server"],"created_at":"2024-10-04T21:03:07.568Z","updated_at":"2025-03-31T17:29:00.339Z","avatar_url":"https://github.com/uncle-lv.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CGI HTTP Server\n\n![license](https://img.shields.io/github/license/uncle-lv/cgi-http-server)  ![stars](https://img.shields.io/github/stars/uncle-lv/cgi-http-server)  ![issues](https://img.shields.io/github/issues/uncle-lv/cgi-http-server)  ![fork](https://img.shields.io/github/forks/uncle-lv/cgi-http-server)  ![platform](https://img.shields.io/badge/platform-only%20linux-orange)\n\n[Chinese](https://github.com/uncle-lv/cgi-http-server/blob/main/README_zh.md) | [English](https://github.com/uncle-lv/cgi-http-server/blob/main/README.md)\n\nA CGI Web Server which is inspired by tiny-httpd and enhanced with the third-party libraries, *[libev](http://software.schmorp.de/pkg/libev)*, *[http-parser](https://github.com/nodejs/http-parser)*, *[hashmap](https://github.com/tidwall/hashmap.c)*, *[log.c](https://github.com/rxi/log.c)*. It shows you how a web server works briefly.\n\n## Functions\n\n- [x] Parse HTTP request\n- [x] Support GET, POST method\n- [x] Support CGI\n- [x] A simple logger\n\n## Usage\n\n1.Install libev and Python3.\n```bash\nsudo apt install -y libev-dev python3\n```\n\n2.Pull the source code.\n```bash\ngit clone https://github.com/uncle-lv/cgi-http-server.git\n```\n\n3.Into the directory `src`, and run `make` to compile the code.\n```bash\nmake\n```\n\n4、Run CGI Server (the argument `port` is optional)\n```bash\n./server {port}\n```\n\n\u003cbr\u003e\n\n\u003e There are several urls for testing, `/index.html`、`/login.html` and etc.\n\u003e \n\u003e You should have the execute permission of CGI scripts.\n\n## Code Structure\n\n```\nsrc\n├── hashmap.c\n├── hashmap.h\n├── http_parser.c\n├── http_parser.h\n├── http_request.c\n├── http_request.h\n├── log.c\n├── log.h\n├── Makefile\n├── server\n└── server.c\n```\n\nIf you want to read the source code, please focus on `http_request.*` and `server.c`. The other files are third-party libraries.\n\n[hashmap](https://github.com/tidwall/hashmap.c): Hashmap implementation in C.\n\n[http_parser](https://github.com/nodejs/http-parser): HTTP request/response parser for C.\n\n[log.c](https://github.com/rxi/log.c): A simple logging library implemented in C99.\n\n## Contributions\n\nLooking forward to Any issue or pull request from you.\n\n## Others\n\n**Maybe** implement the whole HTTP/1.0 and CGI/1.1 in the future.\n\n## License\n\n[MIT](https://github.com/uncle-lv/cgi-http-server/blob/main/LICENSE)\n\n## Thanks\n\n- [tiny-httpd](http://tinyhttpd.sourceforge.net)\n- [libev](http://software.schmorp.de/pkg/libev)\n- [http-parser](https://github.com/nodejs/http-parser)\n- [hashmap](https://github.com/tidwall/hashmap.c)\n- [bjoern](https://github.com/jonashaag/bjoern)\n- [log.c](https://github.com/rxi/log.c)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funcle-lv%2Fcgi-http-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funcle-lv%2Fcgi-http-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funcle-lv%2Fcgi-http-server/lists"}