{"id":18053761,"url":"https://github.com/hymkor/xnhttpd","last_synced_at":"2025-07-14T16:05:13.019Z","repository":{"id":56731776,"uuid":"254670812","full_name":"hymkor/xnhttpd","owner":"hymkor","description":"CGI Server for test uses instead of ANHTTPD","archived":false,"fork":false,"pushed_at":"2025-05-29T16:53:54.000Z","size":116,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-29T18:01:58.482Z","etag":null,"topics":["anhttpd","cgi","cgi-application","go","golang","httpd","httpd-server","web-application"],"latest_commit_sha":null,"homepage":"","language":"Go","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/hymkor.png","metadata":{"files":{"readme":"README.md","changelog":"history.md","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,"zenodo":null}},"created_at":"2020-04-10T15:34:53.000Z","updated_at":"2025-05-29T16:53:57.000Z","dependencies_parsed_at":"2025-04-10T22:53:20.879Z","dependency_job_id":"58af97ee-90ff-487c-9005-a5d87e9b5e88","html_url":"https://github.com/hymkor/xnhttpd","commit_stats":null,"previous_names":["zetamatta/xnhttpd"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/hymkor/xnhttpd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hymkor%2Fxnhttpd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hymkor%2Fxnhttpd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hymkor%2Fxnhttpd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hymkor%2Fxnhttpd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hymkor","download_url":"https://codeload.github.com/hymkor/xnhttpd/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hymkor%2Fxnhttpd/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265314167,"owners_count":23745210,"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":["anhttpd","cgi","cgi-application","go","golang","httpd","httpd-server","web-application"],"created_at":"2024-10-31T00:07:56.616Z","updated_at":"2025-07-14T16:05:13.000Z","avatar_url":"https://github.com/hymkor.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"xnhttpd\r\n=======\r\n\r\n- A simple CGI server for testing, as an alternative to [AN HTTPD](https://ja.wikipedia.org/wiki/AN_HTTPD)\r\n- Markdown viewer\r\n- Experimental Lua application server\r\n\r\n```\r\nxnhttpd {OPTIONS} [SETTING-JSON-PATH]\r\n```\r\n\r\nOptions\r\n-------\r\n\r\n- `-C string`\r\n  Working directory\r\n\r\n- `-hardwrap`\r\n  Enable hard wrap in `*.md`\r\n\r\n- `-html`\r\n  Enable raw HTML in `*.md`\r\n\r\n- `-index string`\r\n  Default page when the URL points to a directory (default: `\"index.html,README.md,INDEX.md\"`)\r\n\r\n- `-p uint`\r\n  Port number (default: `8000`)\r\n\r\n- `-perl`\r\n  Enable Perl as a handler for `*.pl`\r\n\r\nThis starts a local server on `localhost:8000` and allows CGI scripts to run from the current directory.\r\n\r\nExample Setting JSON\r\n--------------------\r\n\r\n```json\r\n{\r\n  \"handler\": {\r\n    \".pl\": \"c:/Program Files/Git/usr/bin/perl.exe\"\r\n  },\r\n  \"markdown\": {\r\n    \"html\": true,\r\n    \"hardwrap\": true\r\n  }\r\n}\r\n```\r\n\r\nTo try the sample [wiki engine](https://github.com/hymkor/markdowned_wifky/), open [`http://127.0.0.1:8000/wiki.pl`](http://127.0.0.1:8000/wiki.pl) in your browser.\r\n\r\nFeatures\r\n--------\r\n\r\n### Markdown Viewer\r\n\r\nWhen a requested URL ends with `.md` and the file exists, the embedded Markdown viewer ([goldmark](https://github.com/yuin/goldmark)) renders it.\r\n\r\nIf `\"html\": true` is set in the JSON config, raw HTML tags are allowed in Markdown files.\r\n\r\n\r\n### Lua Application Server (Experimental)\r\n\r\nWhen a requested URL ends with `.lua` and the file exists, the embedded Lua interpreter ([GopherLua](https://github.com/yuin/gopher-lua)) runs the script.\r\n\r\nExample:\r\n\r\n```lua\r\nprint(\"\u003chtml\u003e\u003cbody\u003e\")\r\nprint(\"\u003ch1\u003eEmbedded Lua Test\u003c/h1\u003e\")\r\n\r\nfor _, key in pairs{\r\n  \"QUERY_STRING\", \"CONTENT_LENGTH\", \"REQUEST_METHOD\",\r\n  \"HTTP_COOKIE\", \"HTTP_USER_AGENT\", \"SCRIPT_NAME\", \"REMOTE_ADDR\"\r\n} do\r\n  print(string.format(\"\u003cdiv\u003e%s=%s\u003c/div\u003e\", esc(key), esc(_G[key])))\r\nend\r\n\r\nprint(\"\u003chr /\u003e\")\r\n\r\nprint(string.format(\"\u003cdiv\u003ea=%s\u003c/div\u003e\", esc(get(\"a\"))))\r\n\r\nprint(string.format([[\r\n\u003cform action=\"%s\" method=\"post\"\u003e\r\n  \u003cdiv\u003eNew `a` value\u003c/div\u003e\r\n  \u003cdiv\u003e\r\n    \u003cinput type=\"text\" name=\"a\" value=\"%s\" /\u003e\r\n    \u003cinput type=\"submit\" /\u003e\r\n  \u003c/div\u003e\r\n\u003c/form\u003e\r\n]], esc(SCRIPT_NAME), esc(get(\"a\"))))\r\n\r\nlocal counter = cookie(\"counter\")\r\nif counter and counter.value then\r\n  counter = { value = tonumber(counter.value) + 1 }\r\nelse\r\n  counter = { value = 1 }\r\nend\r\nsetcookie(\"counter\", counter.value)\r\n\r\nprint(\"counter=\" .. counter.value)\r\nprint(\"\u003c/body\u003e\u003c/html\u003e\")\r\n```\r\n\r\nInstallation\r\n------------\r\n\r\n### Download\r\n\r\nDownload a binary from the [Releases](https://github.com/hymkor/xnhttpd/releases) page and extract the executable.\r\n\r\n### Via `go install`\r\n\r\n```\r\ngo install github.com/hymkor/xnhttpd@latest\r\n```\r\n\r\n### Via Scoop\r\n\r\n```\r\nscoop install https://raw.githubusercontent.com/hymkor/xnhttpd/master/xnhttpd.json\r\n```\r\n\r\nor:\r\n\r\n```\r\nscoop bucket add hymkor https://github.com/hymkor/scoop-bucket\r\nscoop install xnhttpd\r\n```\r\n\r\nAuthor\r\n------\r\n\r\n- [hymkor (HAYAMA Kaoru)](https://github.com/hymkor)\r\n\r\nLicense\r\n-------\r\n\r\n- [MIT License](./LICENSE)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhymkor%2Fxnhttpd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhymkor%2Fxnhttpd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhymkor%2Fxnhttpd/lists"}