From a6cb6f8486cc5a720b74f589a26810c1ab6b64ca Mon Sep 17 00:00:00 2001 From: William Casarin Date: Fri, 4 Nov 2022 17:33:50 -0700 Subject: [PATCH] refactor: rename get_header_remote_ip -> get_header_string This function has nothing to do with remote ips! --- src/server.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server.rs b/src/server.rs index 44e227a..1f4e799 100644 --- a/src/server.rs +++ b/src/server.rs @@ -91,7 +91,7 @@ async fn handle_web_request( .network .remote_ip_header .as_ref() - .and_then(|x| get_header_remote_ip(x, request.headers())); + .and_then(|x| get_header_string(x, request.headers())); // use the socket addr as a backup let remote_ip = header_ip.unwrap_or_else(|| remote_addr.ip().to_string()); @@ -161,7 +161,7 @@ async fn handle_web_request( } } -fn get_header_remote_ip(header: &str, headers: &HeaderMap) -> Option { +fn get_header_string(header: &str, headers: &HeaderMap) -> Option { headers .get(header) .and_then(|x| x.to_str().ok().map(|x| x.to_string()))