From 1f4dc71d95623aa18f4ac248a2f3c763d79ab1a2 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 27 Oct 2018 17:19:08 +0200 Subject: Fix public IP detection (#2084) * Fix public IP detection gethostbyname() may not return the expected public IP in a container deployment or behind a proxy. https://github.com/FreshRSS/FreshRSS/pull/2010/files#r228714764 Might have set to false `pubsubhubbub_enabled` some installations made from stratch from version 1.11.2. * Changelog 2084 --- lib/lib_rss.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/lib_rss.php') diff --git a/lib/lib_rss.php b/lib/lib_rss.php index c816f946e..4087f6faf 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -125,9 +125,8 @@ function server_is_public($address) { )); if ($is_public) { - $ip = gethostbyname($host); - $is_public &= !preg_match('/^(10|127|172[.]16|192[.]168)[.]/', $ip); - $is_public &= !preg_match('/^(\[)?(::1$|fc00::|fe80::)/i', $ip); + $is_public &= !preg_match('/^(10|127|172[.]16|192[.]168)[.]/', $host); + $is_public &= !preg_match('/^(\[)?(::1$|fc00::|fe80::)/i', $host); } return (bool)$is_public; -- cgit v1.2.3