Added timeout

pull/7280/head
Michael 2019-06-18 08:05:45 +00:00
parent ea90554e7f
commit b48a49b0f5
1 changed files with 5 additions and 2 deletions

View File

@ -9,6 +9,7 @@ namespace Friendica\Model;
use Friendica\BaseObject;
use Friendica\Content\Text\HTML;
use Friendica\Core\Logger;
use Friendica\Core\Config;
use Friendica\Database\DBA;
use Friendica\Protocol\ActivityPub;
use Friendica\Util\Network;
@ -33,13 +34,15 @@ class APContact extends BaseObject
return false;
}
$xrd_timeout = Config::get('system', 'xrd_timeout');
$webfinger = 'https://' . $addr_parts[1] . '/.well-known/webfinger?resource=acct:' . urlencode($addr);
$curlResult = Network::curl($webfinger, false, ['accept_content' => 'application/jrd+json,application/json']);
$curlResult = Network::curl($webfinger, false, ['timeout' => $xrd_timeout, 'accept_content' => 'application/jrd+json,application/json']);
if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
$webfinger = 'http://' . $addr_parts[1] . '/.well-known/webfinger?resource=acct:' . urlencode($addr);
$curlResult = Network::curl($webfinger, false, ['accept_content' => 'application/jrd+json,application/json']);
$curlResult = Network::curl($webfinger, false, ['timeout' => $xrd_timeout, 'accept_content' => 'application/jrd+json,application/json']);
if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
return false;