Merge pull request #13100 from MrPetovan/bug/fatal-errors
Wrap HTTP client call in try catch in Network\Probe
This commit is contained in:
commit
b5de664ef6
|
@ -952,9 +952,17 @@ class Probe
|
||||||
*/
|
*/
|
||||||
public static function webfinger(string $url, string $type): array
|
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()) {
|
if ($curlResult->isTimeout()) {
|
||||||
self::$isTimeout = true;
|
self::$isTimeout = true;
|
||||||
return [];
|
return [];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user