{"id":17099829,"url":"https://github.com/cppcoffee/khttpd","last_synced_at":"2025-10-03T14:20:48.103Z","repository":{"id":174323261,"uuid":"652073199","full_name":"cppcoffee/khttpd","owner":"cppcoffee","description":"The HTTP daemon, linux kernel module","archived":false,"fork":false,"pushed_at":"2023-06-22T02:46:55.000Z","size":39,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-13T02:59:56.814Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cppcoffee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-06-11T02:06:52.000Z","updated_at":"2025-03-18T03:00:21.000Z","dependencies_parsed_at":"2023-07-26T12:01:13.357Z","dependency_job_id":null,"html_url":"https://github.com/cppcoffee/khttpd","commit_stats":null,"previous_names":["cppcoffee/khttpd"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cppcoffee/khttpd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cppcoffee%2Fkhttpd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cppcoffee%2Fkhttpd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cppcoffee%2Fkhttpd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cppcoffee%2Fkhttpd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cppcoffee","download_url":"https://codeload.github.com/cppcoffee/khttpd/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cppcoffee%2Fkhttpd/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278173725,"owners_count":25942363,"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","status":"online","status_checked_at":"2025-10-03T02:00:06.070Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-14T15:11:32.429Z","updated_at":"2025-10-03T14:20:48.073Z","avatar_url":"https://github.com/cppcoffee.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# khttpd\n\nThe linux kernel module for HTTP static file service.\n\n## Description\n\nLoaded in the kernel to provide HTTP static file service, support keep-alive and files list.\n\nList of files:\n\n![image](https://github.com/cppcoffee/khttpd/assets/6635286/6f0a2ba0-57ce-4211-a671-b3f013125c6a)\n\n## Prepare\n\nInstalling linux kernel headers on Ubuntu:\n\n```bash\n$ sudo apt-get install linux-headers-$(uname -r)\n```\n\n## build\n\n```bash\n$ make\n```\n\n## Usage\n\nFirst load `khttpd.ko` kernel model:\n\n```bash\n$ sudo insmod ./khttpd.ko port=8000 root=/home/ubuntu/khttpd\n```\n\nit is now listening to `0.0.0.0:8000` and can send requests.\n\nSending http request file:\n\n```shell\n$ curl http://10.211.55.4:8000/src/http_request.c -voa\n  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 10.211.55.4:8000...\n* Connected to 10.211.55.4 (10.211.55.4) port 8000 (#0)\n\u003e GET /src/http_request.c HTTP/1.1\n\u003e Host: 10.211.55.4:8000\n\u003e User-Agent: curl/7.88.1\n\u003e Accept: */*\n\u003e\n\u003c HTTP/1.1 200 OK\n\u003c Server: khttpd/0.0.1\n\u003c Connection: close\n\u003c Content-Length: 4007\n\u003c\n{ [2896 bytes data]\n100  4007  100  4007    0     0   522k      0 --:--:-- --:--:-- --:--:-- 1956k\n* Closing connection 0\n```\n\nFile SHA256\n\n```shell\n$ openssl dgst -sha256 ./a\nSHA256(./a)= 2b9470d3437c346ff716bd9109f7541b286b67651e5eeec01b2629b236255b75\n\n$ openssl dgst -sha256 /home/ubuntu/khttpd/src/http_request.c\nSHA2-256(/home/ubuntu/khttpd/src/http_request.c)= 2b9470d3437c346ff716bd9109f7541b286b67651e5eeec01b2629b236255b75\n```\n\nOf course, it is possible to list the files in the directory if the folder exists:\n\n```shell\n# curl http://127.0.0.1:8000/src -v -L\n*   Trying 127.0.0.1:8000...\n* Connected to 127.0.0.1 (127.0.0.1) port 8000 (#0)\n\u003e GET /src HTTP/1.1\n\u003e Host: 127.0.0.1:8000\n\u003e User-Agent: curl/7.81.0\n\u003e Accept: */*\n\u003e\n* Mark bundle as not supporting multiuse\n\u003c HTTP/1.1 302 Found\n\u003c Server: khttpd/0.0.1\n\u003c Connection: close\n\u003c Location: /src/\n* Closing connection 0\n* Issue another request to this URL: 'http://127.0.0.1:8000/src/'\n* Hostname 127.0.0.1 was found in DNS cache\n*   Trying 127.0.0.1:8000...\n* Connected to 127.0.0.1 (127.0.0.1) port 8000 (#1)\n\u003e GET /src/ HTTP/1.1\n\u003e Host: 127.0.0.1:8000\n\u003e User-Agent: curl/7.81.0\n\u003e Accept: */*\n\u003e\n* Mark bundle as not supporting multiuse\n\u003c HTTP/1.1 200 OK\n\u003c Server: khttpd/0.0.1\n\u003c Connection: close\n\u003c Transfer-Encoding: chunked\n\u003c\n\u003chtml\u003e\u003chead\u003e\u003ctitle\u003eDirectory listing for /src/\u003c/title\u003e\n... ignore more html body ...\n```\n\n## Parameters\n\nThe `khttpd.ko` module provides the following parameters with default values:\n\n```\n# Listening address\nlisten_addr=0.0.0.0\n\n# Listening port\nport=8000\n\n# Pending connections queue size\nbacklog=1024\n\n# Sets the root directory for requests\nroot_dir=/var/www/html\n```\n\n## Reference\n\n[https://github.com/sysprog21/khttpd](https://github.com/sysprog21/khttpd)\n\n[https://github.com/h2o/picohttpparser](https://github.com/h2o/picohttpparser)\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcppcoffee%2Fkhttpd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcppcoffee%2Fkhttpd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcppcoffee%2Fkhttpd/lists"}