{"id":19514633,"url":"https://github.com/epatrizio/chttpserver","last_synced_at":"2026-06-12T06:02:06.491Z","repository":{"id":142915615,"uuid":"369206970","full_name":"epatrizio/chttpserver","owner":"epatrizio","description":"Minimalist and naive http server in C language","archived":false,"fork":false,"pushed_at":"2021-07-02T13:40:47.000Z","size":40,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-08T12:20:57.064Z","etag":null,"topics":["c","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":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/epatrizio.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-05-20T12:51:46.000Z","updated_at":"2024-08-22T15:16:39.000Z","dependencies_parsed_at":"2023-07-27T20:17:48.725Z","dependency_job_id":null,"html_url":"https://github.com/epatrizio/chttpserver","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/epatrizio%2Fchttpserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epatrizio%2Fchttpserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epatrizio%2Fchttpserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epatrizio%2Fchttpserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/epatrizio","download_url":"https://codeload.github.com/epatrizio/chttpserver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240762556,"owners_count":19853503,"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":["c","http-server"],"created_at":"2024-11-10T23:37:10.927Z","updated_at":"2026-06-12T06:02:01.471Z","avatar_url":"https://github.com/epatrizio.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chttpserver - Minimalist and naive http server in C language\n\nI have 20 years of experience in web programming (mainly PHP and Javascript languages).\nActually (2021), I'm in a learning period (exciting). Good!\n\nHow does a web server work over http protocol? Very simple question ;) But, i don't know the answer, and it's a basic server component, OMG!\n\nSo, this side project simply helps me answer this fundamental question. It's therefore a small web server, written in C language, which experiments sockets programming (mechanism proposed by computer OS allowing programs to network access), and back to bacics regards http/1 protocol.\nMy implementation is inspired by this [blog post](https://medium.com/from-the-scratch/http-server-what-do-you-need-to-know-to-build-a-simple-http-server-from-scratch-d1ef8945e4fa), this other one [blog post](https://dev-notes.eu/2018/06/http-server-in-c/) and this [project](http://tinyhttpd.sourceforge.net/).\n\n## Hypertext Transfer Protocol\n\nA web server implements HTTP protocol (an application layer protocol on TCP Transmission Control Protocol, UDP User Datagram Protocol and IP Internet Protocol, the network layer).\n\n* [HTTP/1](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol)\n* [HTTP/2](https://en.wikipedia.org/wiki/HTTP/2) (New version, V1 compatible)\n\nHere, I only implement the basics of http/1 (main headers and methods). It's obviously not a question of implementing whole HTTP (A big and complex stuff ;).\n\nSo, for now, chttpserver support static contents (html, css, javascript, images files).\nAnd PHP CGI (see below) for handling form post and simple data processing.\n\nWith this core features, it becomes possible to run a nice little website. Cool!\n\n## Common Gateway Interface\n\nTo have a nice website, static contents are not sufficient. Quickly, you would like to manipulate data, and generate pages dynamically. Then, you have to use a programming language, you have to interact with a program.\n[CGI - Common Gateway Interface](https://en.wikipedia.org/wiki/Common_Gateway_Interface) help us.\nWikipedia : \"CGI is an interface specification that enables web servers to execute an external program.\".\n\nSo, in chttpserver, i experiment php-cgi. This is the original approach for PHP, but which is now outdated, and replaced by [php-fpm](https://www.php.net/manual/en/install.fpm.php) (FastCGI Process Manager). In our context, that's not a problem.\n\n## Run chttpserver\n\nExecute \"make compile\" and that's all!\nNote that server root is fixed at /home/wwwroot directory.\n\n## Run tests\n\nExecute \"make compile_test\" and that's all!\nI use the framework [ctestfmk](https://github.com/epatrizio/ctestfmk). Read the documentation for more informations.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepatrizio%2Fchttpserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fepatrizio%2Fchttpserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepatrizio%2Fchttpserver/lists"}