1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-23 20:31:28 +00:00

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

View File

@@ -243,6 +243,13 @@
if (!$url) return false; if (!$url) return false;
$url_host = parse_url($url, PHP_URL_HOST); $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; $fetch_domain_hits[$url_host] += 1;
/*if ($fetch_domain_hits[$url_host] > MAX_FETCH_REQUESTS_PER_HOST) { /*if ($fetch_domain_hits[$url_host] > MAX_FETCH_REQUESTS_PER_HOST) {