mirror of
https://github.com/friendica/friendica
synced 2025-05-05 17:44:10 +02:00
Request type set for all HTTP requests
This commit is contained in:
parent
d788cb82cc
commit
5751e024c0
30 changed files with 129 additions and 90 deletions
|
@ -26,6 +26,7 @@ use Friendica\Core\Logger;
|
|||
use Friendica\DI;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
|
||||
use Friendica\Network\HTTPClient\Client\HttpClientRequest;
|
||||
use Friendica\Object\Image;
|
||||
|
||||
/**
|
||||
|
@ -356,7 +357,7 @@ class Images
|
|||
|
||||
if (empty($img_str)) {
|
||||
try {
|
||||
$img_str = DI::httpClient()->fetch($url, HttpClientAccept::IMAGE, 4);
|
||||
$img_str = DI::httpClient()->fetch($url, HttpClientAccept::IMAGE, 4, '', HttpClientRequest::MEDIAVERIFIER);
|
||||
} catch (\Exception $exception) {
|
||||
Logger::notice('Image is invalid', ['url' => $url, 'exception' => $exception]);
|
||||
return [];
|
||||
|
|
|
@ -80,7 +80,7 @@ class Network
|
|||
|
||||
if (in_array(parse_url($url, PHP_URL_SCHEME), ['https', 'http'])) {
|
||||
$options = [HttpClientOptions::VERIFY => true, HttpClientOptions::TIMEOUT => $xrd_timeout,
|
||||
HttpClientOptions::REQUEST => HttpClientRequest::VERIFIER];
|
||||
HttpClientOptions::REQUEST => HttpClientRequest::URLVERIFIER];
|
||||
try {
|
||||
$curlResult = DI::httpClient()->head($url, $options);
|
||||
} catch (\Exception $e) {
|
||||
|
|
|
@ -234,7 +234,7 @@ class ParseUrl
|
|||
}
|
||||
|
||||
try {
|
||||
$curlResult = DI::httpClient()->get($url, HttpClientAccept::HTML, [HttpClientOptions::CONTENT_LENGTH => 1000000]);
|
||||
$curlResult = DI::httpClient()->get($url, HttpClientAccept::HTML, [HttpClientOptions::CONTENT_LENGTH => 1000000, HttpClientOptions::REQUEST => HttpClientRequest::SITEINFO]);
|
||||
} catch (\Throwable $th) {
|
||||
Logger::info('Exception when fetching', ['url' => $url, 'code' => $th->getCode(), 'message' => $th->getMessage()]);
|
||||
return $siteinfo;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue