X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FNetwork.php;h=4a11f9259579e31272b57fdfbe9a1c6d363a8212;hb=596b934a02320eb889998ea56168ac1b60adf7ce;hp=d25b799242e052bc4b3406c2b873bca97a166ee8;hpb=27d94023eef0263a3ce9750f79a73ac941a25304;p=friendica.git diff --git a/src/Util/Network.php b/src/Util/Network.php index d25b799242..4a11f92595 100644 --- a/src/Util/Network.php +++ b/src/Util/Network.php @@ -79,6 +79,18 @@ class Network $a = get_app(); + $parts = parse_url($url); + $path_parts = explode('/', $parts['path']); + foreach ($path_parts as $part) { + if (strlen($part) <> mb_strlen($part)) { + $parts2[] = rawurlencode($part); + } else { + $parts2[] = $part; + } + } + $parts['path'] = implode('/', $parts2); + $url = self::unparseURL($parts); + if (self::isUrlBlocked($url)) { logger('domain of ' . $url . ' is blocked', LOGGER_DATA); return $ret; @@ -434,7 +446,7 @@ class Network /// @TODO Really suppress function outcomes? Why not find them + debug them? $h = @parse_url($url); - if ((is_array($h)) && (@dns_get_record($h['host'], DNS_A + DNS_CNAME + DNS_PTR) || filter_var($h['host'], FILTER_VALIDATE_IP) )) { + if ((is_array($h)) && (@dns_get_record($h['host'], DNS_A + DNS_CNAME) || filter_var($h['host'], FILTER_VALIDATE_IP) )) { return $url; } @@ -459,7 +471,7 @@ class Network $h = substr($addr, strpos($addr, '@') + 1); - if (($h) && (dns_get_record($h, DNS_A + DNS_CNAME + DNS_PTR + DNS_MX) || filter_var($h, FILTER_VALIDATE_IP) )) { + if (($h) && (dns_get_record($h, DNS_A + DNS_CNAME + DNS_MX) || filter_var($h, FILTER_VALIDATE_IP) )) { return true; } return false;