use url::Url;
pub fn resolve_url(raw_href: &str, base_url: &str) -> Option<String> {
if let Ok(abs_url) = Url::parse(raw_href) {
return Some(abs_url.into());
}
match Url::parse(base_url).and_then(|base| base.join(raw_href)) {
Ok(resolved) => Some(resolved.into()),
Err(_) => None,
}
}