Merge pull request #8911 from MrPetovan/task/curl_DI

Introduce "HTTPRequest" class
This commit is contained in:
Michael Vogel 2020-07-25 09:50:20 +02:00 committed by GitHub
commit 398e65d66b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 765 additions and 647 deletions

View file

@ -31,12 +31,9 @@ use Friendica\Database\DBStructure;
use Friendica\DI;
use Friendica\Model\Register;
use Friendica\Module\BaseAdmin;
use Friendica\Module\Update\Profile;
use Friendica\Network\HTTPException\InternalServerErrorException;
use Friendica\Render\FriendicaSmarty;
use Friendica\Util\ConfigFileLoader;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
class Summary extends BaseAdmin
{
@ -249,7 +246,7 @@ class Summary extends BaseAdmin
private static function checkSelfHostMeta()
{
// Fetch the host-meta to check if this really is a vital server
return Network::curl(DI::baseUrl()->get() . '/.well-known/host-meta')->isSuccess();
return DI::httpRequest()->get(DI::baseUrl()->get() . '/.well-known/host-meta')->isSuccess();
}
}

View file

@ -26,7 +26,6 @@ use Friendica\Core\Renderer;
use Friendica\DI;
use Friendica\Model;
use Friendica\Protocol;
use Friendica\Util\Network;
/**
* Tests a given feed of a contact
@ -49,7 +48,7 @@ class Feed extends BaseModule
$contact = Model\Contact::getByURLForUser($url, local_user(), false);
$xml = Network::fetchUrl($contact['poll']);
$xml = DI::httpRequest()->fetch($contact['poll']);
$import_result = Protocol\Feed::import($xml);

View file

@ -28,7 +28,6 @@ use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Util\HTTPSignature;
use Friendica\Util\Network;
use Friendica\Util\Strings;
/**
@ -101,7 +100,7 @@ class Magic extends BaseModule
);
// Try to get an authentication token from the other instance.
$curlResult = Network::curl($basepath . '/owa', false, ['headers' => $headers]);
$curlResult = DI::httpRequest()->get($basepath . '/owa', false, ['headers' => $headers]);
if ($curlResult->isSuccess()) {
$j = json_decode($curlResult->getBody(), true);