Fix cargo clippy issue
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-08-28 08:09:58 +02:00
parent a75ef10f3c
commit 52cca797da

View File

@@ -84,9 +84,9 @@ fn get_remote_ip(req: &HttpRequest, args: &Args) -> String {
let mut ip = req.peer_addr().unwrap().ip().to_string();
// We check if the request comes from a trusted reverse proxy
if let Some(proxy) = args.proxy_ip.as_ref() {
if match_ip(proxy, &ip) {
if let Some(header) = req.headers().get("X-Forwarded-For") {
if let Some(proxy) = args.proxy_ip.as_ref()
&& match_ip(proxy, &ip)
&& let Some(header) = req.headers().get("X-Forwarded-For") {
let header: Vec<String> = header
.to_str()
.unwrap()
@@ -98,8 +98,6 @@ fn get_remote_ip(req: &HttpRequest, args: &Args) -> String {
ip = header[0].to_string();
}
}
}
}
ip
}