Rename HTTPRequestOptions to HTTPClientOptions

This commit is contained in:
Philipp 2021-08-25 21:45:15 +02:00
parent 478f69c403
commit 505100bdd7
No known key found for this signature in database
GPG Key ID: 9A28B7D4FF5667BD
13 changed files with 50 additions and 50 deletions

View File

@ -39,7 +39,7 @@ use Friendica\Model\Event;
use Friendica\Model\Photo; use Friendica\Model\Photo;
use Friendica\Model\Post; use Friendica\Model\Post;
use Friendica\Model\Tag; use Friendica\Model\Tag;
use Friendica\Network\HTTPRequestOptions; use Friendica\Network\HTTPClientOptions;
use Friendica\Object\Image; use Friendica\Object\Image;
use Friendica\Protocol\Activity; use Friendica\Protocol\Activity;
use Friendica\Util\Images; use Friendica\Util\Images;
@ -1194,7 +1194,7 @@ class BBCode
$text = DI::cache()->get($cache_key); $text = DI::cache()->get($cache_key);
if (is_null($text)) { if (is_null($text)) {
$curlResult = DI::httpRequest()->head($match[1], [HTTPRequestOptions::TIMEOUT => DI::config()->get('system', 'xrd_timeout')]); $curlResult = DI::httpRequest()->head($match[1], [HTTPClientOptions::TIMEOUT => DI::config()->get('system', 'xrd_timeout')]);
if ($curlResult->isSuccess()) { if ($curlResult->isSuccess()) {
$mimetype = $curlResult->getHeader('Content-Type')[0] ?? ''; $mimetype = $curlResult->getHeader('Content-Type')[0] ?? '';
} else { } else {
@ -1265,7 +1265,7 @@ class BBCode
return $text; return $text;
} }
$curlResult = DI::httpRequest()->head($match[1], [HTTPRequestOptions::TIMEOUT => DI::config()->get('system', 'xrd_timeout')]); $curlResult = DI::httpRequest()->head($match[1], [HTTPClientOptions::TIMEOUT => DI::config()->get('system', 'xrd_timeout')]);
if ($curlResult->isSuccess()) { if ($curlResult->isSuccess()) {
$mimetype = $curlResult->getHeader('Content-Type')[0] ?? ''; $mimetype = $curlResult->getHeader('Content-Type')[0] ?? '';
} else { } else {

View File

@ -24,7 +24,7 @@ namespace Friendica\Core;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Network\HTTPException; use Friendica\Network\HTTPException;
use Friendica\Network\HTTPRequestOptions; use Friendica\Network\HTTPClientOptions;
use Friendica\Object\Search\ContactResult; use Friendica\Object\Search\ContactResult;
use Friendica\Object\Search\ResultList; use Friendica\Object\Search\ResultList;
use Friendica\Util\Network; use Friendica\Util\Network;
@ -228,7 +228,7 @@ class Search
$return = Contact::searchByName($search, $mode); $return = Contact::searchByName($search, $mode);
} else { } else {
$p = $page > 1 ? 'p=' . $page : ''; $p = $page > 1 ? 'p=' . $page : '';
$curlResult = DI::httpRequest()->get(self::getGlobalDirectory() . '/search/people?' . $p . '&q=' . urlencode($search), [HTTPRequestOptions::ACCEPT_CONTENT => ['application/json']]); $curlResult = DI::httpRequest()->get(self::getGlobalDirectory() . '/search/people?' . $p . '&q=' . urlencode($search), [HTTPClientOptions::ACCEPT_CONTENT => ['application/json']]);
if ($curlResult->isSuccess()) { if ($curlResult->isSuccess()) {
$searchResult = json_decode($curlResult->getBody(), true); $searchResult = json_decode($curlResult->getBody(), true);
if (!empty($searchResult['profiles'])) { if (!empty($searchResult['profiles'])) {

View File

@ -32,7 +32,7 @@ use Friendica\Database\Database;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\Register; use Friendica\Module\Register;
use Friendica\Network\HTTPRequestOptions; use Friendica\Network\HTTPClientOptions;
use Friendica\Network\IHTTPResult; use Friendica\Network\IHTTPResult;
use Friendica\Protocol\Relay; use Friendica\Protocol\Relay;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
@ -315,7 +315,7 @@ class GServer
// When a nodeinfo is present, we don't need to dig further // When a nodeinfo is present, we don't need to dig further
$xrd_timeout = DI::config()->get('system', 'xrd_timeout'); $xrd_timeout = DI::config()->get('system', 'xrd_timeout');
$curlResult = DI::httpRequest()->get($url . '/.well-known/nodeinfo', [HTTPRequestOptions::TIMEOUT => $xrd_timeout]); $curlResult = DI::httpRequest()->get($url . '/.well-known/nodeinfo', [HTTPClientOptions::TIMEOUT => $xrd_timeout]);
if ($curlResult->isTimeout()) { if ($curlResult->isTimeout()) {
self::setFailure($url); self::setFailure($url);
return false; return false;
@ -323,7 +323,7 @@ class GServer
// On a redirect follow the new host but mark the old one as failure // On a redirect follow the new host but mark the old one as failure
if ($curlResult->isSuccess() && (parse_url($url, PHP_URL_HOST) != parse_url($curlResult->getRedirectUrl(), PHP_URL_HOST))) { if ($curlResult->isSuccess() && (parse_url($url, PHP_URL_HOST) != parse_url($curlResult->getRedirectUrl(), PHP_URL_HOST))) {
$curlResult = DI::httpRequest()->get($url, [HTTPRequestOptions::TIMEOUT => $xrd_timeout]); $curlResult = DI::httpRequest()->get($url, [HTTPClientOptions::TIMEOUT => $xrd_timeout]);
if (parse_url($url, PHP_URL_HOST) != parse_url($curlResult->getRedirectUrl(), PHP_URL_HOST)) { if (parse_url($url, PHP_URL_HOST) != parse_url($curlResult->getRedirectUrl(), PHP_URL_HOST)) {
Logger::info('Found redirect. Mark old entry as failure', ['old' => $url, 'new' => $curlResult->getRedirectUrl()]); Logger::info('Found redirect. Mark old entry as failure', ['old' => $url, 'new' => $curlResult->getRedirectUrl()]);
self::setFailure($url); self::setFailure($url);
@ -359,7 +359,7 @@ class GServer
$basedata = ['detection-method' => self::DETECT_MANUAL]; $basedata = ['detection-method' => self::DETECT_MANUAL];
} }
$curlResult = DI::httpRequest()->get($baseurl, [HTTPRequestOptions::TIMEOUT => $xrd_timeout]); $curlResult = DI::httpRequest()->get($baseurl, [HTTPClientOptions::TIMEOUT => $xrd_timeout]);
if ($curlResult->isSuccess()) { if ($curlResult->isSuccess()) {
if ((parse_url($baseurl, PHP_URL_HOST) != parse_url($curlResult->getRedirectUrl(), PHP_URL_HOST))) { if ((parse_url($baseurl, PHP_URL_HOST) != parse_url($curlResult->getRedirectUrl(), PHP_URL_HOST))) {
Logger::info('Found redirect. Mark old entry as failure', ['old' => $url, 'new' => $curlResult->getRedirectUrl()]); Logger::info('Found redirect. Mark old entry as failure', ['old' => $url, 'new' => $curlResult->getRedirectUrl()]);
@ -383,7 +383,7 @@ class GServer
// When the base path doesn't seem to contain a social network we try the complete path. // When the base path doesn't seem to contain a social network we try the complete path.
// Most detectable system have to be installed in the root directory. // Most detectable system have to be installed in the root directory.
// We checked the base to avoid false positives. // We checked the base to avoid false positives.
$curlResult = DI::httpRequest()->get($url, [HTTPRequestOptions::TIMEOUT => $xrd_timeout]); $curlResult = DI::httpRequest()->get($url, [HTTPClientOptions::TIMEOUT => $xrd_timeout]);
if ($curlResult->isSuccess()) { if ($curlResult->isSuccess()) {
$urldata = self::analyseRootHeader($curlResult, $serverdata); $urldata = self::analyseRootHeader($curlResult, $serverdata);
$urldata = self::analyseRootBody($curlResult, $urldata, $url); $urldata = self::analyseRootBody($curlResult, $urldata, $url);
@ -959,7 +959,7 @@ class GServer
private static function validHostMeta(string $url) private static function validHostMeta(string $url)
{ {
$xrd_timeout = DI::config()->get('system', 'xrd_timeout'); $xrd_timeout = DI::config()->get('system', 'xrd_timeout');
$curlResult = DI::httpRequest()->get($url . '/.well-known/host-meta', [HTTPRequestOptions::TIMEOUT => $xrd_timeout]); $curlResult = DI::httpRequest()->get($url . '/.well-known/host-meta', [HTTPClientOptions::TIMEOUT => $xrd_timeout]);
if (!$curlResult->isSuccess()) { if (!$curlResult->isSuccess()) {
return false; return false;
} }
@ -1729,7 +1729,7 @@ class GServer
if (!empty($accesstoken)) { if (!empty($accesstoken)) {
$api = 'https://instances.social/api/1.0/instances/list?count=0'; $api = 'https://instances.social/api/1.0/instances/list?count=0';
$curlResult = DI::httpRequest()->get($api, [HTTPRequestOptions::HEADERS => ['Authorization' => ['Bearer ' . $accesstoken]]]); $curlResult = DI::httpRequest()->get($api, [HTTPClientOptions::HEADERS => ['Authorization' => ['Bearer ' . $accesstoken]]]);
if ($curlResult->isSuccess()) { if ($curlResult->isSuccess()) {
$servers = json_decode($curlResult->getBody(), true); $servers = json_decode($curlResult->getBody(), true);

View File

@ -26,7 +26,7 @@ use Friendica\Core\System;
use Friendica\Database\Database; use Friendica\Database\Database;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Network\HTTPRequestOptions; use Friendica\Network\HTTPClientOptions;
use Friendica\Util\Proxy; use Friendica\Util\Proxy;
/** /**
@ -88,7 +88,7 @@ class Link
{ {
$timeout = DI::config()->get('system', 'xrd_timeout'); $timeout = DI::config()->get('system', 'xrd_timeout');
$curlResult = DI::httpRequest()->head($url, [HTTPRequestOptions::TIMEOUT => $timeout]); $curlResult = DI::httpRequest()->head($url, [HTTPClientOptions::TIMEOUT => $timeout]);
if ($curlResult->isSuccess()) { if ($curlResult->isSuccess()) {
if (empty($media['mimetype'])) { if (empty($media['mimetype'])) {
return $curlResult->getHeader('Content-Type')[0] ?? ''; return $curlResult->getHeader('Content-Type')[0] ?? '';

View File

@ -30,7 +30,7 @@ use Friendica\DI;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Model\Photo; use Friendica\Model\Photo;
use Friendica\Model\Post; use Friendica\Model\Post;
use Friendica\Network\HTTPRequestOptions; use Friendica\Network\HTTPClientOptions;
use Friendica\Util\Images; use Friendica\Util\Images;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\ParseUrl; use Friendica\Util\ParseUrl;
@ -168,7 +168,7 @@ class Media
// Fetch the mimetype or size if missing. // Fetch the mimetype or size if missing.
if (empty($media['mimetype']) || empty($media['size'])) { if (empty($media['mimetype']) || empty($media['size'])) {
$timeout = DI::config()->get('system', 'xrd_timeout'); $timeout = DI::config()->get('system', 'xrd_timeout');
$curlResult = DI::httpRequest()->head($media['url'], [HTTPRequestOptions::TIMEOUT => $timeout]); $curlResult = DI::httpRequest()->head($media['url'], [HTTPClientOptions::TIMEOUT => $timeout]);
if ($curlResult->isSuccess()) { if ($curlResult->isSuccess()) {
if (empty($media['mimetype'])) { if (empty($media['mimetype'])) {
$media['mimetype'] = $curlResult->getHeader('Content-Type')[0] ?? ''; $media['mimetype'] = $curlResult->getHeader('Content-Type')[0] ?? '';

View File

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

View File

@ -95,39 +95,39 @@ class HTTPClient implements IHTTPClient
$conf = []; $conf = [];
if (!empty($opts[HTTPRequestOptions::COOKIEJAR])) { if (!empty($opts[HTTPClientOptions::COOKIEJAR])) {
$jar = new FileCookieJar($opts[HTTPRequestOptions::COOKIEJAR]); $jar = new FileCookieJar($opts[HTTPClientOptions::COOKIEJAR]);
$conf[RequestOptions::COOKIES] = $jar; $conf[RequestOptions::COOKIES] = $jar;
} }
$headers = []; $headers = [];
if (!empty($opts[HTTPRequestOptions::ACCEPT_CONTENT])) { if (!empty($opts[HTTPClientOptions::ACCEPT_CONTENT])) {
$headers['Accept'] = $opts[HTTPRequestOptions::ACCEPT_CONTENT]; $headers['Accept'] = $opts[HTTPClientOptions::ACCEPT_CONTENT];
} }
if (!empty($opts[HTTPRequestOptions::LEGACY_HEADER])) { if (!empty($opts[HTTPClientOptions::LEGACY_HEADER])) {
$this->logger->notice('Wrong option \'headers\' used.'); $this->logger->notice('Wrong option \'headers\' used.');
$headers = array_merge($opts[HTTPRequestOptions::LEGACY_HEADER], $headers); $headers = array_merge($opts[HTTPClientOptions::LEGACY_HEADER], $headers);
} }
if (!empty($opts[HTTPRequestOptions::HEADERS])) { if (!empty($opts[HTTPClientOptions::HEADERS])) {
$headers = array_merge($opts[HTTPRequestOptions::HEADERS], $headers); $headers = array_merge($opts[HTTPClientOptions::HEADERS], $headers);
} }
$conf[RequestOptions::HEADERS] = array_merge($this->client->getConfig(RequestOptions::HEADERS), $headers); $conf[RequestOptions::HEADERS] = array_merge($this->client->getConfig(RequestOptions::HEADERS), $headers);
if (!empty($opts[HTTPRequestOptions::TIMEOUT])) { if (!empty($opts[HTTPClientOptions::TIMEOUT])) {
$conf[RequestOptions::TIMEOUT] = $opts[HTTPRequestOptions::TIMEOUT]; $conf[RequestOptions::TIMEOUT] = $opts[HTTPClientOptions::TIMEOUT];
} }
if (!empty($opts[HTTPRequestOptions::BODY])) { if (!empty($opts[HTTPClientOptions::BODY])) {
$conf[RequestOptions::BODY] = $opts[HTTPRequestOptions::BODY]; $conf[RequestOptions::BODY] = $opts[HTTPClientOptions::BODY];
} }
$conf[RequestOptions::ON_HEADERS] = function (ResponseInterface $response) use ($opts) { $conf[RequestOptions::ON_HEADERS] = function (ResponseInterface $response) use ($opts) {
if (!empty($opts[HTTPRequestOptions::CONTENT_LENGTH]) && if (!empty($opts[HTTPClientOptions::CONTENT_LENGTH]) &&
(int)$response->getHeaderLine('Content-Length') > $opts[HTTPRequestOptions::CONTENT_LENGTH]) { (int)$response->getHeaderLine('Content-Length') > $opts[HTTPClientOptions::CONTENT_LENGTH]) {
throw new TransferException('The file is too big!'); throw new TransferException('The file is too big!');
} }
}; };
@ -185,14 +185,14 @@ class HTTPClient implements IHTTPClient
{ {
$opts = []; $opts = [];
$opts[HTTPRequestOptions::BODY] = $params; $opts[HTTPClientOptions::BODY] = $params;
if (!empty($headers)) { if (!empty($headers)) {
$opts[HTTPRequestOptions::HEADERS] = $headers; $opts[HTTPClientOptions::HEADERS] = $headers;
} }
if (!empty($timeout)) { if (!empty($timeout)) {
$opts[HTTPRequestOptions::TIMEOUT] = $timeout; $opts[HTTPClientOptions::TIMEOUT] = $timeout;
} }
return $this->request('post', $url, $opts); return $this->request('post', $url, $opts);

View File

@ -7,7 +7,7 @@ use GuzzleHttp\RequestOptions;
/** /**
* This class contains a list of possible HTTPClient request options. * This class contains a list of possible HTTPClient request options.
*/ */
class HTTPRequestOptions class HTTPClientOptions
{ {
/** /**
* accept_content: (array) supply Accept: header with 'accept_content' as the value * accept_content: (array) supply Accept: header with 'accept_content' as the value

View File

@ -170,7 +170,7 @@ class Probe
Logger::info('Probing', ['host' => $host, 'ssl_url' => $ssl_url, 'url' => $url, 'callstack' => System::callstack(20)]); Logger::info('Probing', ['host' => $host, 'ssl_url' => $ssl_url, 'url' => $url, 'callstack' => System::callstack(20)]);
$xrd = null; $xrd = null;
$curlResult = DI::httpRequest()->get($ssl_url, [HTTPRequestOptions::TIMEOUT => $xrd_timeout, HTTPRequestOptions::ACCEPT_CONTENT => ['application/xrd+xml']]); $curlResult = DI::httpRequest()->get($ssl_url, [HTTPClientOptions::TIMEOUT => $xrd_timeout, HTTPClientOptions::ACCEPT_CONTENT => ['application/xrd+xml']]);
$ssl_connection_error = ($curlResult->getErrorNumber() == CURLE_COULDNT_CONNECT) || ($curlResult->getReturnCode() == 0); $ssl_connection_error = ($curlResult->getErrorNumber() == CURLE_COULDNT_CONNECT) || ($curlResult->getReturnCode() == 0);
if ($curlResult->isSuccess()) { if ($curlResult->isSuccess()) {
$xml = $curlResult->getBody(); $xml = $curlResult->getBody();
@ -187,7 +187,7 @@ class Probe
} }
if (!is_object($xrd) && !empty($url)) { if (!is_object($xrd) && !empty($url)) {
$curlResult = DI::httpRequest()->get($url, [HTTPRequestOptions::TIMEOUT => $xrd_timeout, HTTPRequestOptions::ACCEPT_CONTENT => ['application/xrd+xml']]); $curlResult = DI::httpRequest()->get($url, [HTTPClientOptions::TIMEOUT => $xrd_timeout, HTTPClientOptions::ACCEPT_CONTENT => ['application/xrd+xml']]);
$connection_error = ($curlResult->getErrorNumber() == CURLE_COULDNT_CONNECT) || ($curlResult->getReturnCode() == 0); $connection_error = ($curlResult->getErrorNumber() == CURLE_COULDNT_CONNECT) || ($curlResult->getReturnCode() == 0);
if ($curlResult->isTimeout()) { if ($curlResult->isTimeout()) {
Logger::info('Probing timeout', ['url' => $url]); Logger::info('Probing timeout', ['url' => $url]);
@ -424,7 +424,7 @@ class Probe
*/ */
private static function getHideStatus($url) private static function getHideStatus($url)
{ {
$curlResult = DI::httpRequest()->get($url, [HTTPRequestOptions::CONTENT_LENGTH => 1000000]); $curlResult = DI::httpRequest()->get($url, [HTTPClientOptions::CONTENT_LENGTH => 1000000]);
if (!$curlResult->isSuccess()) { if (!$curlResult->isSuccess()) {
return false; return false;
} }
@ -940,7 +940,7 @@ class Probe
{ {
$xrd_timeout = DI::config()->get('system', 'xrd_timeout', 20); $xrd_timeout = DI::config()->get('system', 'xrd_timeout', 20);
$curlResult = DI::httpRequest()->get($url, [HTTPRequestOptions::TIMEOUT => $xrd_timeout, HTTPRequestOptions::ACCEPT_CONTENT => [$type]]); $curlResult = DI::httpRequest()->get($url, [HTTPClientOptions::TIMEOUT => $xrd_timeout, HTTPClientOptions::ACCEPT_CONTENT => [$type]]);
if ($curlResult->isTimeout()) { if ($curlResult->isTimeout()) {
self::$istimeout = true; self::$istimeout = true;
return []; return [];

View File

@ -38,7 +38,7 @@ use Friendica\Model\ItemURI;
use Friendica\Model\Post; use Friendica\Model\Post;
use Friendica\Model\Tag; use Friendica\Model\Tag;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Network\HTTPRequestOptions; use Friendica\Network\HTTPClientOptions;
use Friendica\Network\Probe; use Friendica\Network\Probe;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Images; use Friendica\Util\Images;
@ -728,7 +728,7 @@ class OStatus
self::$conv_list[$conversation] = true; self::$conv_list[$conversation] = true;
$curlResult = DI::httpRequest()->get($conversation, [HTTPRequestOptions::ACCEPT_CONTENT => ['application/atom+xml', 'text/html']]); $curlResult = DI::httpRequest()->get($conversation, [HTTPClientOptions::ACCEPT_CONTENT => ['application/atom+xml', 'text/html']]);
if (!$curlResult->isSuccess() || empty($curlResult->getBody())) { if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
return; return;
@ -922,7 +922,7 @@ class OStatus
} }
$stored = false; $stored = false;
$curlResult = DI::httpRequest()->get($related, [HTTPRequestOptions::ACCEPT_CONTENT => ['application/atom+xml', 'text/html']]); $curlResult = DI::httpRequest()->get($related, [HTTPClientOptions::ACCEPT_CONTENT => ['application/atom+xml', 'text/html']]);
if (!$curlResult->isSuccess() || empty($curlResult->getBody())) { if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
return; return;

View File

@ -29,7 +29,7 @@ use Friendica\Model\APContact;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Network\CurlResult; use Friendica\Network\CurlResult;
use Friendica\Network\HTTPRequestOptions; use Friendica\Network\HTTPClientOptions;
use Friendica\Network\IHTTPResult; use Friendica\Network\IHTTPResult;
/** /**
@ -449,8 +449,8 @@ class HTTPSignature
$header['Signature'] = 'keyId="' . $owner['url'] . '#main-key' . '",algorithm="rsa-sha256",headers="(request-target) date host",signature="' . $signature . '"'; $header['Signature'] = 'keyId="' . $owner['url'] . '#main-key' . '",algorithm="rsa-sha256",headers="(request-target) date host",signature="' . $signature . '"';
} }
$curl_opts = $opts; $curl_opts = $opts;
$curl_opts[HTTPRequestOptions::HEADERS] = $header; $curl_opts[HTTPClientOptions::HEADERS] = $header;
if (!empty($opts['nobody'])) { if (!empty($opts['nobody'])) {
$curlResult = DI::httpRequest()->head($request, $curl_opts); $curlResult = DI::httpRequest()->head($request, $curl_opts);

View File

@ -30,7 +30,7 @@ use Friendica\Database\Database;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Network\HTTPException; use Friendica\Network\HTTPException;
use Friendica\Network\HTTPRequestOptions; use Friendica\Network\HTTPClientOptions;
/** /**
* Get information about a given URL * Get information about a given URL
@ -214,7 +214,7 @@ class ParseUrl
return $siteinfo; return $siteinfo;
} }
$curlResult = DI::httpRequest()->get($url, [HTTPRequestOptions::CONTENT_LENGTH => 1000000]); $curlResult = DI::httpRequest()->get($url, [HTTPClientOptions::CONTENT_LENGTH => 1000000]);
if (!$curlResult->isSuccess() || empty($curlResult->getBody())) { if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
return $siteinfo; return $siteinfo;
} }

View File

@ -29,7 +29,7 @@ use Friendica\Model\Contact;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Model\Post; use Friendica\Model\Post;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Network\HTTPRequestOptions; use Friendica\Network\HTTPClientOptions;
use Friendica\Protocol\Activity; use Friendica\Protocol\Activity;
use Friendica\Protocol\ActivityPub; use Friendica\Protocol\ActivityPub;
use Friendica\Protocol\Email; use Friendica\Protocol\Email;
@ -153,7 +153,7 @@ class OnePoll
} }
$cookiejar = tempnam(get_temppath(), 'cookiejar-onepoll-'); $cookiejar = tempnam(get_temppath(), 'cookiejar-onepoll-');
$curlResult = DI::httpRequest()->get($contact['poll'], [HTTPRequestOptions::COOKIEJAR => $cookiejar]); $curlResult = DI::httpRequest()->get($contact['poll'], [HTTPClientOptions::COOKIEJAR => $cookiejar]);
unlink($cookiejar); unlink($cookiejar);
if ($curlResult->isTimeout()) { if ($curlResult->isTimeout()) {