commit a6cb6f8486cc5a720b74f589a26810c1ab6b64ca
parent ae5bf98d87aec405f39a54299466dfa122293f91
Author: William Casarin <jb55@jb55.com>
Date: Fri, 4 Nov 2022 17:33:50 -0700
refactor: rename get_header_remote_ip -> get_header_string
This function has nothing to do with remote ips!
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git 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<String> {
+fn get_header_string(header: &str, headers: &HeaderMap) -> Option<String> {
headers
.get(header)
.and_then(|x| x.to_str().ok().map(|x| x.to_string()))