Rename "HTTPRequest::curl()" to HTTPRequest::get()

This commit is contained in:
nupplaPhil 2020-03-04 22:35:09 +01:00 committed by Hypolite Petovan
parent e5649d6dbf
commit 7029012f27
22 changed files with 66 additions and 64 deletions

View file

@ -22,6 +22,7 @@
namespace Friendica\Protocol;
use Friendica\Core\Protocol;
use Friendica\DI;
use Friendica\Model\APContact;
use Friendica\Model\User;
use Friendica\Util\HTTPSignature;
@ -92,7 +93,7 @@ class ActivityPub
return HTTPSignature::fetch($url, $uid);
}
$curlResult = DI::httpRequest()->curl($url, false, ['accept_content' => 'application/activity+json, application/ld+json']);
$curlResult = DI::httpRequest()->get($url, false, ['accept_content' => 'application/activity+json, application/ld+json']);
if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
return false;
}

View file

@ -1194,7 +1194,7 @@ class DFRN
Logger::log('dfrn_deliver: ' . $url);
$curlResult = DI::httpRequest()->curl($url);
$curlResult = DI::httpRequest()->get($url);
if ($curlResult->isTimeout()) {
return -2; // timed out

View file

@ -755,7 +755,7 @@ class OStatus
self::$conv_list[$conversation] = true;
$curlResult = DI::httpRequest()->curl($conversation, false, ['accept_content' => 'application/atom+xml, text/html']);
$curlResult = DI::httpRequest()->get($conversation, false, ['accept_content' => 'application/atom+xml, text/html']);
if (!$curlResult->isSuccess()) {
return;
@ -784,7 +784,7 @@ class OStatus
}
}
if ($file != '') {
$conversation_atom = DI::httpRequest()->curl($attribute['href']);
$conversation_atom = DI::httpRequest()->get($attribute['href']);
if ($conversation_atom->isSuccess()) {
$xml = $conversation_atom->getBody();
@ -901,7 +901,7 @@ class OStatus
return;
}
$curlResult = DI::httpRequest()->curl($self);
$curlResult = DI::httpRequest()->get($self);
if (!$curlResult->isSuccess()) {
return;
@ -948,7 +948,7 @@ class OStatus
}
$stored = false;
$curlResult = DI::httpRequest()->curl($related, false, ['accept_content' => 'application/atom+xml, text/html']);
$curlResult = DI::httpRequest()->get($related, false, ['accept_content' => 'application/atom+xml, text/html']);
if (!$curlResult->isSuccess()) {
return;
@ -979,7 +979,7 @@ class OStatus
}
}
if ($atom_file != '') {
$curlResult = DI::httpRequest()->curl($atom_file);
$curlResult = DI::httpRequest()->get($atom_file);
if ($curlResult->isSuccess()) {
Logger::log('Fetched XML for URI ' . $related_uri, Logger::DEBUG);
@ -991,7 +991,7 @@ class OStatus
// Workaround for older GNU Social servers
if (($xml == '') && strstr($related, '/notice/')) {
$curlResult = DI::httpRequest()->curl(str_replace('/notice/', '/api/statuses/show/', $related) . '.atom');
$curlResult = DI::httpRequest()->get(str_replace('/notice/', '/api/statuses/show/', $related) . '.atom');
if ($curlResult->isSuccess()) {
Logger::log('GNU Social workaround to fetch XML for URI ' . $related_uri, Logger::DEBUG);
@ -1002,7 +1002,7 @@ class OStatus
// Even more worse workaround for GNU Social ;-)
if ($xml == '') {
$related_guess = self::convertHref($related_uri);
$curlResult = DI::httpRequest()->curl(str_replace('/notice/', '/api/statuses/show/', $related_guess) . '.atom');
$curlResult = DI::httpRequest()->get(str_replace('/notice/', '/api/statuses/show/', $related_guess) . '.atom');
if ($curlResult->isSuccess()) {
Logger::log('GNU Social workaround 2 to fetch XML for URI ' . $related_uri, Logger::DEBUG);

View file

@ -30,7 +30,6 @@ use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\GContact;
use Friendica\Model\GServer;
use Friendica\Network\HTTPRequest;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Strings;
@ -251,7 +250,7 @@ class PortableContact
*/
private static function fetchServerlist($poco)
{
$curlResult = DI::httpRequest()->curl($poco . "/@server");
$curlResult = DI::httpRequest()->get($poco . "/@server");
if (!$curlResult->isSuccess()) {
return;
@ -291,7 +290,7 @@ class PortableContact
Logger::info("Fetch all users from the server " . $server["url"]);
$curlResult = DI::httpRequest()->curl($url);
$curlResult = DI::httpRequest()->get($url);
if ($curlResult->isSuccess() && !empty($curlResult->getBody())) {
$data = json_decode($curlResult->getBody(), true);
@ -314,7 +313,7 @@ class PortableContact
$success = false;
$curlResult = DI::httpRequest()->curl($url);
$curlResult = DI::httpRequest()->get($url);
if ($curlResult->isSuccess() && !empty($curlResult->getBody())) {
Logger::info("Fetch all global contacts from the server " . $server["nurl"]);
@ -372,7 +371,7 @@ class PortableContact
// Fetch all contacts from a given user from the other server
$url = $server['poco'] . '/' . $username . '/?fields=displayName,urls,photos,updated,network,aboutMe,currentLocation,tags,contactType,generation';
$curlResult = DI::httpRequest()->curl($url);
$curlResult = DI::httpRequest()->get($url);
if ($curlResult->isSuccess()) {
$data = json_decode($curlResult->getBody(), true);