{"id":35120497,"url":"https://github.com/samicpp/csweb","last_synced_at":"2026-03-18T01:35:12.355Z","repository":{"id":320393407,"uuid":"1081881898","full_name":"samicpp/csweb","owner":"samicpp","description":"a webserver that uses `samicpp/dotnet-http`","archived":false,"fork":false,"pushed_at":"2026-01-08T12:27:36.000Z","size":133,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-08T23:31:07.550Z","etag":null,"topics":["configurable","csharp","dotnet","http-server","tls-support","webserver"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samicpp.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-23T12:29:21.000Z","updated_at":"2026-01-08T12:27:39.000Z","dependencies_parsed_at":"2025-10-25T04:02:30.268Z","dependency_job_id":null,"html_url":"https://github.com/samicpp/csweb","commit_stats":null,"previous_names":["samicpp/csweb"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/samicpp/csweb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samicpp%2Fcsweb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samicpp%2Fcsweb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samicpp%2Fcsweb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samicpp%2Fcsweb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samicpp","download_url":"https://codeload.github.com/samicpp/csweb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samicpp%2Fcsweb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30640248,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-18T00:09:27.587Z","status":"ssl_error","status_checked_at":"2026-03-18T00:09:26.123Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["configurable","csharp","dotnet","http-server","tls-support","webserver"],"created_at":"2025-12-27T23:43:03.806Z","updated_at":"2026-03-18T01:35:12.345Z","avatar_url":"https://github.com/samicpp.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# csweb\na highly configurable webserver that uses [samicpp/dotnet-http](https://github.com/samicpp/dotnet-http) \u003cbr/\u003e\n\n\n## Config\n\n### Server settings\ninside `appsettings.json` you can specify the work and serve directory, which ports to listen to, ssl certificate, and log level. \u003cbr/\u003e\nthis file needs to be in the same directory as the application or project directory. \u003cbr/\u003e\nsee [appsettings.default.json](./web/appsettings.default.json) for the default (or fallback if not present)\nand [appsettings.comments.json](./web/appsettings.comments.json) for comments explaining each item. \u003cbr/\u003e\nappsettings.default.json\n```json\n{\n    \"09-address\": [ ],\n    \"h2c-address\": [ ],\n    \"h2-address\": [ ],\n    \"ssl-address\": [ ],\n    \"poly-address\": [ ],\n    \n    \"p12-cert\": null,\n    \"p12-pass\": null,\n    \"alpn\": [ \"h2\", \"http/1.1\" ],\n    \"fallback-alpn\": null,\n    \n    \"cwd\": null,\n    \"backlog\": 10,\n    \"dualmode\": false,\n\n    \"serve-dir\": \"./\",\n    \"use-compression\": true,\n    \"bigfile-threshold\": 16777216,\n    \"bigfile-chunk-size\": 16777216,\n    \"stream-bigfiles\": false,\n\n    \"loglevel\": null\n}\n```\n\n### Destination settings\ndestination settings are inside of `routes.json` which need be located in the serve directory. \u003cbr/\u003e\nthis file should contain a syntex similar to the following:\n```json\n{\n    \"default\": {\n        \"dir\": \"sub dir\"\n    },\n\n    \"query\": {\n        \"match-type\": \"type\",\n        \"dir\": \"sub dir\"\n    },\n\n    \"query2\": {\n        \"match-type\": \"type\",\n        \"dir\": \"sub dir\",\n        \"router\": \"file\"\n    }\n}\n```\n- `match-type` string = \"host\" | \"start\" | \"end\" | \"regex\" | \"path-start\" | \"scheme\" | \"protocol\" | \"domain\"\n- - `host`: matches the host from the host header provided by the client\n- - `start`: matches the start of the whole requested uri (`scheme://host/path`)\n- - `end`: matches the end of the whole requested uri\n- - `path-start`: matches only the start of the requested path\n- - `scheme`: matches the scheme, always `http` or `https` unless using a non official version\n- - `protocol`: matches the protocol used (http version), always `HTTP/1.1` | `HTTP/2` (| `HTTP/3` planned)\n- - `domain`: matches the domain (e.g. `www.example.com` matches domain `example.com`)\n- `dir` is used to decide the requested file `CWD/ServeDir/SubDir/Path`\n- `router` specifies a file to be used instead of path to calculate destination. always a file\n\nthe server will attempt to match each item starting at the top (skipping over `default`) and will fetch content from the sub directory starting at serve directory. \u003cbr/\u003e\nif this file isnt present it will attempt to fetch content from the serve directory directly. \u003cbr/\u003e\nif nothing was matched it will try to use the `default` entry. required to be present \u003cbr/\u003e\nwhen the file is changed the server will refresh its configuration. if the file is removed it wont remove the config \u003cbr/\u003e\nmatching is case insensitive \u003cbr/\u003e\n\n### Static Headers\nin the same location where the destination settings are located, you can also optionally include a `headers.json` file. \u003cbr/\u003e\nthe server will set these headers regardless of the request.\n```json\n{\n    \"Header1\": \"value1\",\n    \"Header2\": \"value2\"\n}\n```\n\n## Files\nbesides normal files the server also supports some files that invoke custom behaviour \u003cbr/\u003e\n| file extension | description |\n|--|--|\n| `*.3xx.redirect` | redirects to the contents of the file. is a \"special file\" |\n| `*.var.*` | contents get served with the correct content-type. is a \"special file\" |\n| `*.link` | acts as a sort of symlink, needs to contain a absolute path or relative path to the cwd. is a \"special file\" |\n| `*.dll` | loads that dll, hands it over control, and awaits it. dlls only get reimported if they change |\n| `*.s.cs` \\| `*.s.fs` \\| `*.s.ps1` | **not yet supported**. hands over control to these sippets |\n| `*.ffi.dll` \\| `*.ffi.so` | **not yet supported**. loads a native library, passes it function pointers for \"basic\" http response and then invokes another function. |\n\n### Special files\nthese files get read as pieces of text and then replaces certain strings with different strings \u003cbr/\u003e\n| variable | description |\n|--|--|\n| `\"%IP%\"` | gets replaced by the clients remote address |\n| `\"%FULL_IP%\"` | gets replaced by the clients remote address and port |\n| `%PATH%` | gets replaced by the path |\n| `%HOST%` | gets replaced by the host |\n| `%SCHEME%` | gets replaced by `http` or `https` |\n| `%BASE_DIR%` | gets replaced by the serve directory |\n| `%USER_AGENT%` | gets replaced by the full user agent header |\n| `%DOMAIN%` | gets replaced by an estimated guess of the domain (`www.example.com` -\u003e `example.com`) |\n\n\n## Planned\n\n### Features\n- [x] allow serving files\n- [x] allow simple dynamic content files\n- [x] add middleware support\n- [x] add protocol detection (auto choose HTTP/1.1, HTTP/2, Tls)\n- [x] support partial content / byte ranges\n- [x] support simple builtin request handlers to avoid duplication\n- [x] allow specifying http authentication in routes config\n- [ ] add script support\n- [ ] ~~overhaul logging \u0026~~ support logserver and reports\n- [ ] overhaul routes config making it more powerfull\n- [ ] add configurable conditions in routes\n- [ ] support FFI libraries\n\n### Enhancements\n- [X] support tls\n- [X] support json config files\n- [x] add file caching\n- [x] add regex file matching config files\n- [ ] make cache use compressed data \u0026 allow pre compressed files\n- [ ] update/modernize request handling logic\n- [ ] support pem certs in addition to PKCS#12\n\n### Planning\n| Version | Change | Date | Status |\n|--|--|--|--|\n| v1.x.x.x | Fundamental (HTTP/1.1) | 23-10-2025 | ✓ |\n| v1.1.x.x | Support config | 23-10-2025 | ✓ |\n| v2.x.x.x | HTTP/2 | 24-10-2025 | ✓ |\n| v2.3.x.x | Support TLS | 24-10-2025 | ✓ |\n| v2.8.x.x | Protocol detection | 02-01-2026 | ✓ |\n| v2.9.x.x | FFI support | - | - |\n| v2.11.x.x | Script support | - | - |\n| v3.x.x.x | HTTP/3 | - | - |\n| v4.x.x.x | Switch to self made web framework | - | - |\n| v5.x.x.x | Build parts in C++ | - | - |\n\n## Versioning scheme\n- `Y.x.x.x`: fundamental/major change\n- `x.Y.x.x`: added features / big changes\n- `x.x.Y.x`: minor features / big bugfix\n- `x.x.x.Y`: very small changes / bugfix\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamicpp%2Fcsweb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamicpp%2Fcsweb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamicpp%2Fcsweb/lists"}