Commit Graph

201 Commits

Author SHA1 Message Date
xfy
1b3fcf7443 feat(reverse_proxy): add basic proxy 2025-06-01 21:48:55 +08:00
xfy
136345e872 feat: improve server error display 2025-06-01 20:16:44 +08:00
xfy
bcf088c347 refactor(ssl): use axum_server to handle tls 2025-06-01 20:11:48 +08:00
xfy
8d35c26d90 chore: bump deps 2025-05-31 02:40:18 +08:00
xfy
6a47df5ba3 refactor: remove useless if statement 2025-05-30 16:31:49 +08:00
xfy
3d8c9d44e1 feat(http): add custom not found status code 2025-05-18 04:00:51 +08:00
xfy
17ef670de5 chore: update editorconfig
change markdown indent size to 2
2025-05-18 03:42:55 +08:00
xfy
d5751f1e14 perf(hashmap): use dashmap as global store 2025-05-16 15:57:06 +08:00
xfy
f86bb996b1 fix(http): multiple vhost share same config 2025-05-14 15:41:29 +08:00
xfy
02d02b68ee refactor(http): optimize port parse
add port to route map
2025-05-14 02:42:58 +08:00
xfy
23523c6a37 chore: update runner config 2025-05-12 09:35:17 +08:00
xfy
b5656ff75a fix: handle virtual host error 2025-05-10 01:51:18 +08:00
xfy
e870704cb6 chore: gracefully handle unwrap 2025-05-10 01:29:21 +08:00
xfy
fdbecfbbe9 chore: format macros 2025-05-10 01:07:01 +08:00
xfy
87e34d655d feat(http): implement 304 Not Modified 2025-05-04 00:42:01 +08:00
xfy
3d0e8ba591 feat(http): calculate file etag 2025-05-03 23:20:59 +08:00
xfy
67df0d7db5 fix(serve): fix generate default index
Fix the route was not found due to an empty path.
2025-04-23 21:36:00 +08:00
xfy
e0b5e1a280 docs(todo): add list directory as todo 2025-04-23 21:11:59 +08:00
xfy
c860ac1a55 chore(deps): bump dependecies 2025-04-23 21:05:12 +08:00
xfy
ae612fc20d chore(docs): update todo 2025-04-23 20:49:03 +08:00
xfy
b37ff4607b feat(http): implement custom headers 2025-04-23 20:32:27 +08:00
xfy
07094124d0 ci(macos): run check/test/build in parallel 2025-04-22 21:49:33 +08:00
xfy
60a12113a9 chore(test): add config struct unit test 2025-04-22 21:46:26 +08:00
xfy
f9e0c7839f ci(macos): add clippy check 2025-04-22 21:40:35 +08:00
xfy
b313f870df ci(macos): add cargo cache 2025-04-22 21:37:50 +08:00
a4187b831e Create macos-arm.yml 2025-04-22 20:44:02 +08:00
xfy
58e7fdc255 feat(ssl): add ssl support 2025-04-22 16:26:27 +08:00
xfy
718d13a13a feat(http): enhance error handling and config clarity
- Refactored `serve.rs` loop for robustness (tries all paths before failing).
- Improved error messages in `error.rs` for better debugging.
- Updated `config.rs` and `config.example_full.toml` to reflect new defaults.
- Added debug logs for failed path attempts in file serving.
2025-04-22 15:51:58 +08:00
xfy
c6ff8af73e feat: add custom error message 2025-04-22 15:23:46 +08:00
xfy
f100fbd0ee feat(route): add response compression 2025-04-15 21:35:56 +08:00
xfy
6c0e6dd341 refactor(serve): improve path handling robustness and logging
- Modified file-serving loop to either:
  - Try all paths in `path_arr` before failing (Option 1), or
  - Document fast-fail behavior (Option 2).
- Added debug logs for failed path attempts.

Improves resilience or clarity, depending on chosen approach.
2025-04-12 17:38:05 +08:00
xfy
5be7cf0cf4 refactor(serve): improve path handling and error logging
- Extracted `resolve_parent_path` helper for URI/path logic reuse.
- Replaced `if let Ok` with explicit `match` in file streaming loop.
- Added debug logs for path resolution and file streaming failures.

No functional changes; focuses on maintainability and debuggability.
2025-04-12 17:15:12 +08:00
xfy
6756daf8ef chore(serve): clarify path handling logic and add comments
- Added detailed comments to `serve.rs` to explain URI path resolution, error cases, and file streaming.
- Improved readability of path slicing and fallback logic.
- Updated dependencies in `Cargo.toml` and `Cargo.lock` as needed.

🤖 Generated with [avante.nvim](https://github.com/yetone/avante.nvim)
Co-Authored-By: avante.nvim <noreply-avante@yetone.ai>
2025-04-12 17:04:14 +08:00
xfy
a39d5a8a24 chore(debug): add route register debug info 2025-04-12 16:27:46 +08:00
xfy
93629c75ae feat(http): improve route registration and path handling
- Refactor route registration in `mod.rs` to handle paths with/without trailing slashes.
- Enhance `serve.rs` to safely handle optional path segments and improve URI parsing.
- Add debug logs for better tracing of route resolution.
- Ensure UTF-8 compatibility and bounds safety in path slicing.

🤖 Generated with [avante.nvim](https://github.com/yetone/avante.nvim)
Co-Authored-By: avante.nvim <noreply-avante@yetone.ai>
2025-04-12 15:42:15 +08:00
xfy
251f47f760 refactor: update router error handling
- Add not found error
- Update error output, use plain text instead of json
2025-04-10 10:57:31 +08:00
xfy
14cdf3b35d feat(http): enhance path handling
- Add global route map to store static routes.
- Match parent path to find route in route map.
2025-04-10 10:40:45 +08:00
xfy
1fe812ef4c feat(http): enhance path handling with safe string slicing
- Replace direct slicing (`&s[0..5]`) with safe methods (`get`) in `serve.rs` to avoid panics.
- Add UTF-8 safety checks for paths with non-ASCII characters.
- Improve error handling for invalid slices using `unwrap_or_default`.

This ensures robust path manipulation in dynamic routing scenarios.

🤖 Generated with [avante.nvim](https://github.com/yetone/avante.nvim)
Co-Authored-By: avante.nvim <noreply-avante@yetone.ai>
2025-04-10 10:28:24 +08:00
xfy
32e068c1a4 feat(http): enhance dynamic routing and error handling
- Refactor `src/http/mod.rs` to support runtime route configuration.
- Update `src/http/serve.rs` with Axum server setup and middleware integration.
- Improve error handling in `src/http/error.rs` for HTTP-specific cases.
- Extend middleware utilities in `src/middlewares/mod.rs`.

🤖 Generated with [avante.nvim](https://github.com/yetone/avante.nvim)
Co-Authored-By: avante.nvim <noreply-avante@yetone.ai>
2025-04-10 09:36:28 +08:00
xfy
c879e07a63 feat(http): implement dynamic routing with Axum
- Add dynamic route generation in `src/http/mod.rs` to support runtime configuration.
- Integrate shared `AppState` and middleware (e.g., timeout, logging) in `src/http/serve.rs`.
- Update `src/config.rs` to include route configuration.
- Refactor `src/main.rs` to initialize the HTTP server with dynamic routes.

🤖 Generated with [avante.nvim](https://github.com/yetone/avante.nvim)
Co-Authored-By: avante.nvim <noreply-avante@yetone.ai>
2025-04-10 09:34:26 +08:00
xfy
45d8c36136 refactor: change backend to axum 2025-04-08 09:24:13 +08:00
xfy
e8c425d5fe feat: add connection timeout 2025-03-27 16:21:47 +08:00
xfy
c66a3f1322 feat: add middlewares 2025-03-27 16:16:57 +08:00
xfy
654a51227b handle static file with route service 2025-03-27 14:34:09 +08:00
xfy
d862e2eece add static file handle 2025-03-27 14:29:27 +08:00
xfy
e169478bbf refactor: refactor with axum 2025-03-27 13:55:49 +08:00
xfy
0879dac0ca refactor: refactor condition 2025-03-27 13:07:38 +08:00
xfy
c0a4fbfc19 perf: change memory allocator to mimalloc 2025-03-27 09:23:24 +08:00
xfy
b38de3a325 refactor: refactor condition 2025-03-26 15:48:16 +08:00
xfy
01bd1128c4 chore: update load certificate message 2025-03-13 17:21:13 +08:00