kumo 0.2.3

An async web crawling framework for Rust — Scrapy for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
/// Returns `true` if `url`'s host equals `domain` or is a subdomain of it.
pub(super) fn host_matches_domain(url: &str, domain: &str) -> bool {
    url::Url::parse(url)
        .ok()
        .and_then(|u| {
            u.host_str()
                .map(|h| h == domain || h.ends_with(&format!(".{domain}")))
        })
        .unwrap_or(false)
}