Merge pull request #13100 from MrPetovan/bug/fatal-errors

Wrap HTTP client call in try catch in Network\Probe
This commit is contained in:
Michael Vogel 2023-05-07 12:27:27 +02:00 committed by GitHub
commit b5de664ef6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -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 [];