Wrap HTTP client call in try catch in Network\Probe
- Address https://github.com/friendica/friendica/issues/13023#issuecomment-1521458475
This commit is contained in:
parent
f673232e53
commit
bce7e85e1f
1 changed files with 10 additions and 2 deletions
|
@ -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 [];
|
||||
|
|
Loading…
Reference in a new issue