perf: remove format for X-Forwarded-For header (#25)
This commit is contained in:
parent
4b3e3ffda1
commit
c25de2e313
12
src/lib.rs
12
src/lib.rs
@ -215,9 +215,15 @@ fn create_proxied_request<B>(
|
|||||||
entry.insert(client_ip.to_string().parse()?);
|
entry.insert(client_ip.to_string().parse()?);
|
||||||
}
|
}
|
||||||
|
|
||||||
hyper::header::Entry::Occupied(mut entry) => {
|
hyper::header::Entry::Occupied(entry) => {
|
||||||
let addr = format!("{}, {}", entry.get().to_str()?, client_ip);
|
let client_ip_str = client_ip.to_string();
|
||||||
entry.insert(addr.parse()?);
|
let mut addr =
|
||||||
|
String::with_capacity(entry.get().as_bytes().len() + 2 + client_ip_str.len());
|
||||||
|
|
||||||
|
addr.push_str(std::str::from_utf8(entry.get().as_bytes()).unwrap());
|
||||||
|
addr.push(',');
|
||||||
|
addr.push(' ');
|
||||||
|
addr.push_str(&client_ip_str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user