change path name and server name to specific stract to find longest prefix and exact matching in hashtables

This commit is contained in:
Jun Kurihara 2022-07-28 21:46:53 +09:00
commit 1a70869227
No known key found for this signature in database
GPG key ID: 48ADFD173ED22B03
5 changed files with 89 additions and 20 deletions

View file

@ -19,7 +19,7 @@ impl ReverseProxy {
pub fn get<'a>(&self, path_str: impl Into<Cow<'a, str>>) -> Option<&UpstreamGroup> {
// trie使ってlongest prefix match させてもいいけどルート記述は少ないと思われるので、
// コスト的にこの程度で十分
let path_bytes = &(path_str.to_path_name_vec())[..];
let path_bytes = &path_str.to_path_name_vec();
let matched_upstream = self
.upstream
@ -40,7 +40,7 @@ impl ReverseProxy {
if let Some((_path, u)) = matched_upstream {
debug!(
"Found upstream: {:?}",
String::from_utf8(_path.to_vec()).unwrap_or_else(|_| "<none>".to_string())
String::from_utf8(_path.0.clone()).unwrap_or_else(|_| "<none>".to_string())
);
Some(u)
} else {