mirror of
https://github.com/friendica/friendica
synced 2025-04-26 11:50:11 +00:00
Curl Response Refactoring
- refactored Network::post() - replaced every Network::post() execution with the new Curl container
This commit is contained in:
parent
2dec8895a9
commit
7c73e8634c
10 changed files with 24 additions and 25 deletions
|
@ -1469,16 +1469,17 @@ class DFRN
|
|||
|
||||
$content_type = ($public_batch ? "application/magic-envelope+xml" : "application/json");
|
||||
|
||||
$xml = Network::post($dest_url, $envelope, ["Content-Type: ".$content_type]);
|
||||
$postResult = Network::post($dest_url, $envelope, ["Content-Type: ".$content_type]);
|
||||
$xml = $postResult->getBody();
|
||||
|
||||
$curl_stat = Network::getCurl()->getCode();
|
||||
$curl_stat = $postResult->getReturnCode();
|
||||
if (empty($curl_stat) || empty($xml)) {
|
||||
logger('Empty answer from ' . $contact['id'] . ' - ' . $dest_url);
|
||||
Contact::markForArchival($contact);
|
||||
return -9; // timed out
|
||||
}
|
||||
|
||||
if (($curl_stat == 503) && (stristr(Network::getCurl()->getHeaders(), 'retry-after'))) {
|
||||
if (($curl_stat == 503) && (stristr($postResult->getHeader(), 'retry-after'))) {
|
||||
Contact::markForArchival($contact);
|
||||
return -10;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue