Implement rate limiting with 41 responses and comprehensive logging

- Add concurrent connection handling with tokio::spawn for proper rate limiting
- Send '41 Server unavailable' responses instead of dropping connections
- Move request logger initialization earlier to enable rate limiting logs
- Add logging for rate limited requests: 'Concurrent request limit exceeded'
- Fix clippy warnings: needless borrows and match simplification
- Update test script analysis to expect 41 responses for rate limiting
This commit is contained in:
Jeena 2026-01-16 06:00:18 +00:00
parent da39f37559
commit 33ae576b25
5 changed files with 52 additions and 20 deletions

View file

@ -76,6 +76,13 @@ nothing else. It is meant to be generic so other people can use it.
- src/server.rs:16-17 - Unnecessary borrows on file_path
- src/logging.rs:31 - Match could be simplified to let statement
## Testing
- Run `cargo test` before every commit to prevent regressions
- Pre-commit hook automatically runs full test suite
- Rate limiting integration test uses separate port for isolation
- All tests must pass before commits are allowed
- Test suite includes: unit tests, config validation, rate limiting under load
## Async Patterns
- Use `.await` on async calls
- Prefer `tokio::fs` over `std::fs` in async contexts