]> git.mxchange.org Git - friendica.git/commitdiff
Better handling of timeout issues while probing
authorMichael <heluecht@pirati.ca>
Wed, 31 May 2017 03:46:43 +0000 (03:46 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 31 May 2017 03:46:43 +0000 (03:46 +0000)
src/Network/Probe.php

index 94fa2733befa7eba890c82e457d3a84d27f4da40..531fdfef640c247d74ebe7bae69f4fcdea08ed4f 100644 (file)
@@ -123,13 +123,13 @@ class Probe {
                }
                if (!is_object($xrd)) {
                        logger("No xrd object found for ".$host, LOGGER_DEBUG);
-                       return false;
+                       return array();
                }
 
                $links = xml::element_to_array($xrd);
                if (!isset($links["xrd"]["link"])) {
                        logger("No xrd data found for ".$host, LOGGER_DEBUG);
-                       return false;
+                       return array();
                }
 
                $xrd_data = array();
@@ -222,6 +222,10 @@ class Probe {
                $lrdd = self::xrd($uri);
                $webfinger = null;
 
+               if (is_bool($lrdd)) {
+                       return array();
+               }
+
                if (!$lrdd) {
                        $parts = @parse_url($uri);
                        if (!$parts) {
@@ -424,6 +428,10 @@ class Probe {
                        }
                        $lrdd = self::xrd($host);
 
+                       if (is_bool($lrdd)) {
+                               return array();
+                       }
+
                        $path_parts = explode("/", trim($parts["path"], "/"));
 
                        while (!$lrdd AND (sizeof($path_parts) > 1)) {
@@ -462,6 +470,10 @@ class Probe {
                        }
                        $lrdd = self::xrd($host);
 
+                       if (is_bool($lrdd)) {
+                               return array();
+                       }
+
                        if (!$lrdd) {
                                logger('No XRD data was found for '.$uri, LOGGER_DEBUG);
                                return self::mail($uri, $uid);