mirror of
https://github.com/friendica/friendica
synced 2025-04-30 09:44:22 +02:00
Restructure HTTPClient for new paradigm
This commit is contained in:
parent
fa55928ea3
commit
409d909d0f
25 changed files with 210 additions and 198 deletions
|
@ -28,9 +28,9 @@ use Friendica\DI;
|
|||
use Friendica\Model\APContact;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Network\CurlResult;
|
||||
use Friendica\Network\HTTPClientOptions;
|
||||
use Friendica\Network\IHTTPResult;
|
||||
use Friendica\Network\HTTPClient\Response\CurlResult;
|
||||
use Friendica\Network\HTTPClient\Client\HttpClientOptions;
|
||||
use Friendica\Network\HTTPClient\Capability\ICanHandleHttpResponses;
|
||||
|
||||
/**
|
||||
* Implements HTTP Signatures per draft-cavage-http-signatures-07.
|
||||
|
@ -414,7 +414,7 @@ class HTTPSignature
|
|||
* 'nobody' => only return the header
|
||||
* 'cookiejar' => path to cookie jar file
|
||||
*
|
||||
* @return IHTTPResult CurlResult
|
||||
* @return \Friendica\Network\HTTPClient\Capability\ICanHandleHttpResponses CurlResult
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function fetchRaw($request, $uid = 0, $opts = ['accept_content' => ['application/activity+json', 'application/ld+json']])
|
||||
|
@ -450,7 +450,7 @@ class HTTPSignature
|
|||
}
|
||||
|
||||
$curl_opts = $opts;
|
||||
$curl_opts[HTTPClientOptions::HEADERS] = $header;
|
||||
$curl_opts[HttpClientOptions::HEADERS] = $header;
|
||||
|
||||
if (!empty($opts['nobody'])) {
|
||||
$curlResult = DI::httpClient()->head($request, $curl_opts);
|
||||
|
|
|
@ -30,7 +30,7 @@ use Friendica\Database\Database;
|
|||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Network\HTTPClientOptions;
|
||||
use Friendica\Network\HTTPClient\Client\HttpClientOptions;
|
||||
|
||||
/**
|
||||
* Get information about a given URL
|
||||
|
@ -214,7 +214,7 @@ class ParseUrl
|
|||
return $siteinfo;
|
||||
}
|
||||
|
||||
$curlResult = DI::httpClient()->get($url, [HTTPClientOptions::CONTENT_LENGTH => 1000000]);
|
||||
$curlResult = DI::httpClient()->get($url, [HttpClientOptions::CONTENT_LENGTH => 1000000]);
|
||||
if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
|
||||
return $siteinfo;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue