mirror of
https://git.proxmox.com/git/proxmox-websocket-tunnel
synced 2025-06-14 19:32:45 +00:00
use itertools and from_utf8_unchecked
avoid allocations and skip the utf8 check on the hex string Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
941f0305a2
commit
1b7d246040
@ -15,6 +15,7 @@ futures = "0.3"
|
|||||||
futures-util = "0.3"
|
futures-util = "0.3"
|
||||||
hex = "0.4"
|
hex = "0.4"
|
||||||
hyper = "0.14"
|
hyper = "0.14"
|
||||||
|
itertools = "0.10"
|
||||||
openssl = "0.10"
|
openssl = "0.10"
|
||||||
percent-encoding = "2"
|
percent-encoding = "2"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
@ -159,6 +159,7 @@ impl CtrlTunnel {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use itertools::Itertools;
|
||||||
let fp = match cert.digest(openssl::hash::MessageDigest::sha256()) {
|
let fp = match cert.digest(openssl::hash::MessageDigest::sha256()) {
|
||||||
Ok(fp) => fp,
|
Ok(fp) => fp,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
@ -171,8 +172,7 @@ impl CtrlTunnel {
|
|||||||
let fp_string = fp_string
|
let fp_string = fp_string
|
||||||
.as_bytes()
|
.as_bytes()
|
||||||
.chunks(2)
|
.chunks(2)
|
||||||
.map(|v| std::str::from_utf8(v).unwrap())
|
.map(|v| unsafe { std::str::from_utf8_unchecked(v) })
|
||||||
.collect::<Vec<&str>>()
|
|
||||||
.join(":");
|
.join(":");
|
||||||
|
|
||||||
let expected = expected.to_lowercase();
|
let expected = expected.to_lowercase();
|
||||||
|
Loading…
Reference in New Issue
Block a user