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

@ -1,3 +1,6 @@
- implement a real rate limiting test which sets max=1 and then creates 1000 concurrent requests and checks if we get a 41 response
- remove the CLI options, everything should be only configurable via config file
- seperate tests into unit/integration and system tests, at least by naming convention, but perhaps there is a rust way to do it
- add a system test which tests that the server really responds with 44 before 41
- the request size is limited to 1024 + 2 bytes for CRLF, make sure we follow this part of the spec
- do we do URL parsing when we get a request? We should and reject wrong URIs as bad request
- we should also check that the port is correct in the URI
- we should use a logger and not print debug stuff so that we can set the log level