{"id":18043500,"url":"https://github.com/fumiama/simple-http-server","last_synced_at":"2025-04-09T22:11:44.806Z","repository":{"id":64588585,"uuid":"374552949","full_name":"fumiama/simple-http-server","owner":"fumiama","description":"A variant of Tinyhttpd.","archived":false,"fork":false,"pushed_at":"2024-06-02T15:03:30.000Z","size":195,"stargazers_count":9,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T22:11:39.141Z","etag":null,"topics":["cgi","http","http-server","http1-0","httpd","tinyhttp","tinyhttpd"],"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/fumiama.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-07T06:04:46.000Z","updated_at":"2024-06-02T15:03:33.000Z","dependencies_parsed_at":"2024-04-12T14:44:51.581Z","dependency_job_id":"1a7f88c1-ead6-4b8f-9a01-3cbd8ccd5f2c","html_url":"https://github.com/fumiama/simple-http-server","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumiama%2Fsimple-http-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumiama%2Fsimple-http-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumiama%2Fsimple-http-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumiama%2Fsimple-http-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fumiama","download_url":"https://codeload.github.com/fumiama/simple-http-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119294,"owners_count":21050755,"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","http1-0","httpd","tinyhttp","tinyhttpd"],"created_at":"2024-10-30T17:08:52.052Z","updated_at":"2025-04-09T22:11:44.786Z","avatar_url":"https://github.com/fumiama.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\".github/shinsako.jpg\" width = \"360\" height = \"360\" alt=\"Shinsako\"\u003e\u003cbr\u003e\n  \u003ch1\u003esimple-http-server\u003c/h1\u003e\n  A variant of Tinyhttpd.\u003cbr\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n\u003e Created November 1999 by J. David Blackstone.\n\u003e \n\u003e Optimized June 2021 by Fumiama(源文雨)\n\n## Protocol\nA necessary subset of `HTTP 1.0` with following options of request header being supported.\n\n### From client\n- Content-Length\n\n### From server\n- Content-Length\n- Content-Type (only support text/plain image/x-icon text/css text/html)\n- Server\n\n### Code\n- 200 OK\n- 400 BAD REQUEST\n- 403 Forbidden\n- 404 NOT FOUND\n- 500 Internal Server Error\n- 501 Method Not Implemented\n\n## Features\n1. Serve files\n2. CGI\n3. Listen on `ipv6`\n4. Listen on unix socket\n5. Multi-thread\n\n## Compile\n```bash\ngit clone https://github.com/fumiama/simple-http-server.git\ncd simple-http-server\nmkdir build\ncd build\ncmake ..\nmake\nmake install\n```\n\n## Command line usage\n```bash\nsimple-http-server [-d] [-h] [-n host.name.com:port] [-p \u003cport|unix socket path\u003e] [-q 16] [-r \u003crootdir\u003e] [-u \u003cuid\u003e]\n```\n\n- **-d**:  run as daemon.\n- **-h**:  display this help.\n- **-n**:  check hostname and port.\n- **-p**:  if not set, we will choose a random port.\n- **-q**:  listen queue length (defalut is 16).\n- **-r**:  http root dir.\n- **-u**:  run as this uid.\n\n## CGI usage\nWhen you put an executable file into the web path, the server will call `execl` to run it while passing 3 parameters as below\n\n```c\nargv[0] = path;   //Path of the executable file\nargv[1] = method; //request method (GET/POST)\nargv[2] = query_string;   //the query string, like \"a=1\u0026b=2\u0026c=3\"\n```\n\nThe server will read a `4 bytes` unsigned integer from pipe, indicating the `length` of the remaining content. Then it will send `length` bytes of data to the client directly with nothing being decorated, which means that you need to assemble the HTTP header by yourself.\n\nHere is a CGI example [CMoe-Counter](https://github.com/fumiama/CMoe-Counter)\n\nAnd its realization is here:\n\n\u003cdiv align=center\u003e \u003ca href=\"#\"\u003e \u003cimg src=\"https://counter.seku.su/cmoe?name=shttps\u0026theme=gb\" /\u003e \u003c/a\u003e \u003c/div\u003e\n\n## Appendix\n### 4096 Threads Pressure Test Video\n\nhttps://user-images.githubusercontent.com/41315874/223675866-3536d0ba-3400-46f4-9431-795f133cb94b.mp4\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffumiama%2Fsimple-http-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffumiama%2Fsimple-http-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffumiama%2Fsimple-http-server/lists"}