Skip to main content

host_allowed

Function host_allowed 

Source
pub fn host_allowed(host: &str, allowed: &[String]) -> bool
Expand description

true when host (a host[:port]) is permitted by allowed, an empty list permitting everything. Entries match case-insensitively either the whole authority or just the host part.

use solid_pod_rs_server::scheme::host_allowed;
let allow = vec!["pod.example".to_string()];
assert!(host_allowed("POD.example:8443", &allow));
assert!(!host_allowed("evil.example", &allow));
assert!(host_allowed("anything", &[]));