feat: add handling of tls cert for delegated hosts

This commit is contained in:
Gabriel Souza Franco 2021-04-15 22:07:27 -03:00
parent 18398e1f17
commit 0b56589dce
5 changed files with 82 additions and 128 deletions

View file

@ -74,6 +74,16 @@ where
.write()
.unwrap()
.insert(Box::<ServerName>::from(destination), result.clone());
let actual_destination = result.0.strip_prefix("https://").unwrap().splitn(2, ':').next().unwrap();
let host = result.1.splitn(2, ':').next().unwrap_or(&result.1);
if actual_destination != host {
globals.tls_name_override.write().unwrap().insert(
actual_destination.to_owned(),
webpki::DNSNameRef::try_from_ascii_str(&host)
.unwrap()
.to_owned(),
);
}
result
};