{"id":23418751,"url":"https://github.com/dzove855/bash-web-server","last_synced_at":"2025-05-16T15:03:11.904Z","repository":{"id":43732940,"uuid":"444444001","full_name":"dzove855/Bash-web-server","owner":"dzove855","description":"A purely bash web server, no socat, netcat, etc... ","archived":false,"fork":false,"pushed_at":"2024-02-29T19:18:54.000Z","size":74,"stargazers_count":964,"open_issues_count":2,"forks_count":47,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-05-16T15:02:17.445Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/dzove855.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}},"created_at":"2022-01-04T14:13:14.000Z","updated_at":"2025-05-15T09:13:20.000Z","dependencies_parsed_at":"2024-02-29T20:27:28.723Z","dependency_job_id":"7683fc24-05eb-4728-b3c4-b5508621b228","html_url":"https://github.com/dzove855/Bash-web-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/dzove855%2FBash-web-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzove855%2FBash-web-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzove855%2FBash-web-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dzove855%2FBash-web-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dzove855","download_url":"https://codeload.github.com/dzove855/Bash-web-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254553936,"owners_count":22090415,"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":[],"created_at":"2024-12-23T00:38:11.527Z","updated_at":"2025-05-16T15:03:11.852Z","avatar_url":"https://github.com/dzove855.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bash-web-server\nA purely bash web server, no socat, netcat, etc... \n\n# Requirement\n* bash 5.2 (The patch will be included in bash5.2 - Alpha release already contains the patch)\n* if bash version is under 5.2, patched loadable accept builtin (http://git.savannah.gnu.org/cgit/bash.git/tree/examples/loadables/accept.c) is needed, you have to apply accept.patch to your loadable accept.c file which is existed in bash source code, and than build and install the loadable accept builtin into BASH_LOADABLE_PATH specified in `bash-server.sh`\n\n# How to\nThe port can be set by the env var: HTTP_PORT\n\nThe path to accept (Directory) can be set by using: BASH_LOADABLES_PATH (see man bash)\n\nServer Methods:\n* serveHtml (needs DOCUMENT_ROOT envvars) - This will serve the static files\n* script file - The script need a file as first argument which will be source. The file will need a function named runner, which will be run on each request\n\nBasic authentication can be enabled by env var: BASIC_AUTH, accounts and passwords are stored in the file specified in $BASIC_AUTH_FILE\n\n\n# Usage\nSimple explication of various functions that could be used.\n\n## Session Handling\nVariables:\n\n```\n    SESSION_COOKIE\n        The name of the cookie : default BASHSESSID\n```\n\nFunctions:\n\n```\n    sessionStart\n        Start a session or reuse an existing session\n\n    sessionSet $1 $2\n        Set a session variable\n\n    sessionGet $1 \n        Get the value of the given variable\n```\n\n## Cookie Handling\nFunctions:\n\n```\n    cookieSet $1 \n        Send the cookie\n        Example: cookieSet \"BASHSESSID=12345; max-age=5000\" \n```\n\n## HTTP Handling\nFunctions:\n\n```\n    httpSendStatus $1 \n        Send the provided http status\n        Example: httpSendStatus 200\n\n    To set Headers, you should add an entry inside the assoc var HTTP_RESPONSE_HEADERS\n        HTTP_RESPONSE_HEADERS[\"ExampleHeader\"]=\"The value of the Header\"\n```\n\n## Websocket\n!!!NOTE: This is still expiremental and only works for sendin data, not receiving! \n\nFunctions:\n```\n    websocketStart FUNCTION\n        Start the websocket server\n\n    websocketStop\n        Stop the websocket server inside the function\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdzove855%2Fbash-web-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdzove855%2Fbash-web-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdzove855%2Fbash-web-server/lists"}