1
0
Fork 0

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

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

View file

@ -71,7 +71,7 @@ class HTTPRequest
* @return CurlResult
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public function curl(string $url, bool $binary = false, array $opts = [], int &$redirects = 0)
public function get(string $url, bool $binary = false, array $opts = [], int &$redirects = 0)
{
$stamp1 = microtime(true);
@ -206,7 +206,7 @@ class HTTPRequest
$redirects++;
$this->logger->notice('Curl redirect.', ['url' => $url, 'to' => $curlResponse->getRedirectUrl()]);
@curl_close($ch);
return $this->curl($curlResponse->getRedirectUrl(), $binary, $opts, $redirects);
return $this->get($curlResponse->getRedirectUrl(), $binary, $opts, $redirects);
}
@curl_close($ch);
@ -486,7 +486,7 @@ class HTTPRequest
*/
public function fetchUrlFull(string $url, bool $binary = false, int $timeout = 0, string $accept_content = '', string $cookiejar = '', int &$redirects = 0)
{
return $this->curl(
return $this->get(
$url,
$binary,
[

View file

@ -166,7 +166,7 @@ class Probe
Logger::info('Probing', ['host' => $host, 'ssl_url' => $ssl_url, 'url' => $url, 'callstack' => System::callstack(20)]);
$xrd = null;
$curlResult = DI::httpRequest()->curl($ssl_url, false, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
$curlResult = DI::httpRequest()->get($ssl_url, false, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
$ssl_connection_error = ($curlResult->getErrorNumber() == CURLE_COULDNT_CONNECT) || ($curlResult->getReturnCode() == 0);
if ($curlResult->isSuccess()) {
$xml = $curlResult->getBody();
@ -183,7 +183,7 @@ class Probe
}
if (!is_object($xrd) && !empty($url)) {
$curlResult = DI::httpRequest()->curl($url, false, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
$curlResult = DI::httpRequest()->get($url, false, ['timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml']);
$connection_error = ($curlResult->getErrorNumber() == CURLE_COULDNT_CONNECT) || ($curlResult->getReturnCode() == 0);
if ($curlResult->isTimeout()) {
Logger::info('Probing timeout', ['url' => $url]);
@ -427,7 +427,7 @@ class Probe
*/
private static function getHideStatus($url)
{
$curlResult = DI::httpRequest()->curl($url);
$curlResult = DI::httpRequest()->get($url);
if (!$curlResult->isSuccess()) {
return false;
}
@ -841,7 +841,7 @@ class Probe
public static function pollZot($url, $data)
{
$curlResult = DI::httpRequest()->curl($url);
$curlResult = DI::httpRequest()->get($url);
if ($curlResult->isTimeout()) {
return $data;
}
@ -938,7 +938,7 @@ class Probe
{
$xrd_timeout = DI::config()->get('system', 'xrd_timeout', 20);
$curlResult = DI::httpRequest()->curl($url, false, ['timeout' => $xrd_timeout, 'accept_content' => $type]);
$curlResult = DI::httpRequest()->get($url, false, ['timeout' => $xrd_timeout, 'accept_content' => $type]);
if ($curlResult->isTimeout()) {
self::$istimeout = true;
return [];
@ -1007,7 +1007,7 @@ class Probe
*/
private static function pollNoscrape($noscrape_url, $data)
{
$curlResult = DI::httpRequest()->curl($noscrape_url);
$curlResult = DI::httpRequest()->get($noscrape_url);
if ($curlResult->isTimeout()) {
self::$istimeout = true;
return [];
@ -1265,7 +1265,7 @@ class Probe
*/
private static function pollHcard($hcard_url, $data, $dfrn = false)
{
$curlResult = DI::httpRequest()->curl($hcard_url);
$curlResult = DI::httpRequest()->get($hcard_url);
if ($curlResult->isTimeout()) {
self::$istimeout = true;
return [];
@ -1519,7 +1519,7 @@ class Probe
$pubkey = substr($pubkey, 5);
}
} elseif (Strings::normaliseLink($pubkey) == 'http://') {
$curlResult = DI::httpRequest()->curl($pubkey);
$curlResult = DI::httpRequest()->get($pubkey);
if ($curlResult->isTimeout()) {
self::$istimeout = true;
return $short ? false : [];
@ -1552,7 +1552,7 @@ class Probe
}
// Fetch all additional data from the feed
$curlResult = DI::httpRequest()->curl($data["poll"]);
$curlResult = DI::httpRequest()->get($data["poll"]);
if ($curlResult->isTimeout()) {
self::$istimeout = true;
return [];
@ -1604,7 +1604,7 @@ class Probe
*/
private static function pumpioProfileData($profile_link)
{
$curlResult = DI::httpRequest()->curl($profile_link);
$curlResult = DI::httpRequest()->get($profile_link);
if (!$curlResult->isSuccess()) {
return [];
}
@ -1835,7 +1835,7 @@ class Probe
*/
private static function feed($url, $probe = true)
{
$curlResult = DI::httpRequest()->curl($url);
$curlResult = DI::httpRequest()->get($url);
if ($curlResult->isTimeout()) {
self::$istimeout = true;
return [];