fetch_file_contents: resolve requested hosts and check for possible

loopback address
This commit is contained in:
Andrew Dolgov 2020-09-17 07:36:47 +03:00
parent 88c4dc405e
commit 213d6330b1
1 changed files with 7 additions and 0 deletions

View File

@ -243,6 +243,13 @@
if (!$url) return false;
$url_host = parse_url($url, PHP_URL_HOST);
$ip_addr = gethostbyname($url_host);
if (!$ip_addr || strpos($ip_addr, "127.0") === 0) {
$fetch_last_error = "URL hostname failed to resolve or resolved to loopback address ($ip_addr)";
return false;
}
$fetch_domain_hits[$url_host] += 1;
/*if ($fetch_domain_hits[$url_host] > MAX_FETCH_REQUESTS_PER_HOST) {