viewgit/inc/functions.php:22 Function utf8_encode() is deprecated [8192]

Make internal requests work better for getPage, a=chris

Chris Pollett [2018-04-14 17:Apr:th]
Make internal requests work better for getPage, a=chris
Filename
src/library/FetchUrl.php
diff --git a/src/library/FetchUrl.php b/src/library/FetchUrl.php
index b1468a8d9..9b6de1f1f 100755
--- a/src/library/FetchUrl.php
+++ b/src/library/FetchUrl.php
@@ -770,10 +770,14 @@ class FetchUrl implements CrawlConstants
             !C\nsdefined("IS_OWN_WEB_SERVER"));
         $MAX_SIZE = 50;
         $host = @parse_url($site, PHP_URL_HOST);
+        $local_hosts = ['localhost', '::1', '0.0.0.0',
+            '127.0.0.1', $_SERVER['SERVER_NAME']];
+        if (substr($_SERVER['SERVER_NAME'], 0, 3) != "www") {
+            $local_hosts[] = "www" . $_SERVER['SERVER_NAME'];
+        }
         if ($host !== false) {
             if (C\nsdefined("IS_OWN_WEB_SERVER") &&
-                in_array($host, ['localhost', '::1', '0.0.0.0',
-                '127.0.0.1', $_SERVER['SERVER_NAME']])) {
+                in_array($host, $local_hosts)) {
                 $port = @parse_url($site, PHP_URL_PORT);
                 if ($port == $_SERVER['SERVER_PORT']) {
                     if (empty($GLOBALS['web_site'])) {
ViewGit