From bce7e85e1f26c2d19b995e51b200b800b6c0260d Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 7 May 2023 00:26:16 -0400 Subject: [PATCH] Wrap HTTP client call in try catch in Network\Probe - Address https://github.com/friendica/friendica/issues/13023#issuecomment-1521458475 --- src/Network/Probe.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Network/Probe.php b/src/Network/Probe.php index d344d556c3..b1931ae6d3 100644 --- a/src/Network/Probe.php +++ b/src/Network/Probe.php @@ -952,9 +952,17 @@ class Probe */ public static function webfinger(string $url, string $type): array { - $xrd_timeout = DI::config()->get('system', 'xrd_timeout', 20); + try { + $curlResult = DI::httpClient()->get( + $url, + $type, + [HttpClientOptions::TIMEOUT => DI::config()->get('system', 'xrd_timeout', 20)] + ); + } catch (\Throwable $e) { + Logger::notice($e->getMessage(), ['url' => $url, 'type' => $type, 'class' => get_class($e)]); + return []; + } - $curlResult = DI::httpClient()->get($url, $type, [HttpClientOptions::TIMEOUT => $xrd_timeout]); if ($curlResult->isTimeout()) { self::$isTimeout = true; return []; -- 2.39.5