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:
parent
da39f37559
commit
33ae576b25
5 changed files with 52 additions and 20 deletions
|
|
@ -28,13 +28,10 @@ impl RequestLogger {
|
|||
}
|
||||
|
||||
fn extract_client_ip(stream: &TlsStream<TcpStream>) -> String {
|
||||
match stream.get_ref() {
|
||||
(tcp_stream, _) => {
|
||||
match tcp_stream.peer_addr() {
|
||||
Ok(addr) => addr.to_string(),
|
||||
Err(_) => "unknown".to_string(),
|
||||
}
|
||||
}
|
||||
let (tcp_stream, _) = stream.get_ref();
|
||||
match tcp_stream.peer_addr() {
|
||||
Ok(addr) => addr.to_string(),
|
||||
Err(_) => "unknown".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue