Allow HTTP to be used for configuring the server

This commit is contained in:
Maurus Decimus
2026-04-27 07:48:36 +02:00
parent cd4b08544c
commit 242bea67d9
8 changed files with 45 additions and 25 deletions

View File

@@ -340,12 +340,18 @@ pub fn sanitize_domain(domain: &str) -> Option<String> {
}
}
if found_dot
&& last_ch != '.'
&& psl::domain(result.as_bytes()).is_some_and(|d| d.suffix().typ().is_some())
{
if found_dot && last_ch != '.' && is_valid_domain(&result) {
Some(result)
} else {
None
}
}
pub fn is_valid_domain(domain: &str) -> bool {
const RESERVED_TLDS: &[&str] = &["test", "localhost", "local", "internal"];
psl::domain(domain.as_bytes()).is_some_and(|d| d.suffix().typ().is_some())
|| RESERVED_TLDS.contains(&domain)
|| domain
.rsplit_once('.')
.is_some_and(|(_, tld)| RESERVED_TLDS.contains(&tld))
}