Use HTTPRequestOptions constants for HTTPClient::post()
This commit is contained in:
parent
e9902401a5
commit
aad7bac686
|
@ -39,6 +39,7 @@ use Friendica\Model\Event;
|
|||
use Friendica\Model\Photo;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Model\Tag;
|
||||
use Friendica\Network\HTTPRequestOptions;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Protocol\Activity;
|
||||
use Friendica\Util\Images;
|
||||
|
@ -1193,7 +1194,7 @@ class BBCode
|
|||
$text = DI::cache()->get($cache_key);
|
||||
|
||||
if (is_null($text)) {
|
||||
$curlResult = DI::httpRequest()->head($match[1], ['timeout' => DI::config()->get('system', 'xrd_timeout')]);
|
||||
$curlResult = DI::httpRequest()->head($match[1], [HTTPRequestOptions::TIMEOUT => DI::config()->get('system', 'xrd_timeout')]);
|
||||
if ($curlResult->isSuccess()) {
|
||||
$mimetype = $curlResult->getHeader('Content-Type')[0] ?? '';
|
||||
} else {
|
||||
|
@ -1264,7 +1265,7 @@ class BBCode
|
|||
return $text;
|
||||
}
|
||||
|
||||
$curlResult = DI::httpRequest()->head($match[1], ['timeout' => DI::config()->get('system', 'xrd_timeout')]);
|
||||
$curlResult = DI::httpRequest()->head($match[1], [HTTPRequestOptions::TIMEOUT => DI::config()->get('system', 'xrd_timeout')]);
|
||||
if ($curlResult->isSuccess()) {
|
||||
$mimetype = $curlResult->getHeader('Content-Type')[0] ?? '';
|
||||
} else {
|
||||
|
|
|
@ -26,6 +26,7 @@ use Friendica\Core\System;
|
|||
use Friendica\Database\Database;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\HTTPRequestOptions;
|
||||
use Friendica\Util\Proxy;
|
||||
|
||||
/**
|
||||
|
@ -87,7 +88,7 @@ class Link
|
|||
{
|
||||
$timeout = DI::config()->get('system', 'xrd_timeout');
|
||||
|
||||
$curlResult = DI::httpRequest()->head($url, ['timeout' => $timeout]);
|
||||
$curlResult = DI::httpRequest()->head($url, [HTTPRequestOptions::TIMEOUT => $timeout]);
|
||||
if ($curlResult->isSuccess()) {
|
||||
if (empty($media['mimetype'])) {
|
||||
return $curlResult->getHeader('Content-Type')[0] ?? '';
|
||||
|
|
|
@ -30,6 +30,7 @@ use Friendica\DI;
|
|||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Network\HTTPRequestOptions;
|
||||
use Friendica\Util\Images;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\ParseUrl;
|
||||
|
@ -167,7 +168,7 @@ class Media
|
|||
// Fetch the mimetype or size if missing.
|
||||
if (empty($media['mimetype']) || empty($media['size'])) {
|
||||
$timeout = DI::config()->get('system', 'xrd_timeout');
|
||||
$curlResult = DI::httpRequest()->head($media['url'], ['timeout' => $timeout]);
|
||||
$curlResult = DI::httpRequest()->head($media['url'], [HTTPRequestOptions::TIMEOUT => $timeout]);
|
||||
if ($curlResult->isSuccess()) {
|
||||
if (empty($media['mimetype'])) {
|
||||
$media['mimetype'] = $curlResult->getHeader('Content-Type')[0] ?? '';
|
||||
|
|
|
@ -29,6 +29,7 @@ use Friendica\Model\APContact;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Network\CurlResult;
|
||||
use Friendica\Network\HTTPRequestOptions;
|
||||
use Friendica\Network\IHTTPResult;
|
||||
|
||||
/**
|
||||
|
@ -449,7 +450,7 @@ class HTTPSignature
|
|||
}
|
||||
|
||||
$curl_opts = $opts;
|
||||
$curl_opts['header'] = $header;
|
||||
$curl_opts[HTTPRequestOptions::HEADERS] = $header;
|
||||
|
||||
if (!empty($opts['nobody'])) {
|
||||
$curlResult = DI::httpRequest()->head($request, $curl_opts);
|
||||
|
|
Loading…
Reference in New Issue
Block a user