resolve TODO comment for Url

This commit is contained in:
Johann150 2021-02-19 12:01:59 +01:00
parent beb48937e0
commit b5fa24cb5b
No known key found for this signature in database
GPG key ID: 9EE6577A2A06F8F1
3 changed files with 14 additions and 13 deletions

View file

@ -305,8 +305,9 @@ impl RequestHandle {
}
if let Some(host) = url.host() {
// TODO: to_owned can be removed in next version of url https://github.com/servo/rust-url/pull/651
if !ARGS.hostnames.is_empty() && !ARGS.hostnames.contains(&host.to_owned()) {
// do not use "contains" here since it requires the same type and does
// not allow to check for Host<&str> if the vec contains Hostname<String>
if !ARGS.hostnames.is_empty() && !ARGS.hostnames.iter().any(|h| h == &host) {
return Err((53, "Proxy request refused"));
}
} else {