<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
namespace Friendica\Protocol;
use Friendica\Core\Logger;
-use Friendica\Network\HTTPRequest;
+use Friendica\DI;
use Friendica\Network\Probe;
use Friendica\Util\Crypto;
use Friendica\Util\Strings;
$ret[$x] = substr($ret[$x], 5);
}
} elseif (Strings::normaliseLink($ret[$x]) == 'http://') {
- $ret[$x] = HTTPRequest::fetchUrl($ret[$x]);
+ $ret[$x] = DI::httpClient()->fetch($ret[$x]);
}
}
}
$salmon = XML::fromArray($xmldata, $xml, false, $namespaces);
// slap them
- $postResult = DI::httpRequest()->post($url, $salmon, [
- 'Content-type: application/magic-envelope+xml',
- 'Content-length: ' . strlen($salmon)
+ $postResult = DI::httpClient()->post($url, $salmon, [
+ 'Content-type' => 'application/magic-envelope+xml',
+ 'Content-length' => strlen($salmon),
]);
$return_code = $postResult->getReturnCode();
$salmon = XML::fromArray($xmldata, $xml, false, $namespaces);
// slap them
- $postResult = DI::httpRequest()->post($url, $salmon, [
- 'Content-type: application/magic-envelope+xml',
- 'Content-length: ' . strlen($salmon)
+ $postResult = DI::httpClient()->post($url, $salmon, [
+ 'Content-type' => 'application/magic-envelope+xml',
+ 'Content-length' => strlen($salmon),
]);
$return_code = $postResult->getReturnCode();
}
$salmon = XML::fromArray($xmldata, $xml, false, $namespaces);
// slap them
- $postResult = DI::httpRequest()->post($url, $salmon, [
- 'Content-type: application/magic-envelope+xml',
- 'Content-length: ' . strlen($salmon)]);
+ $postResult = DI::httpClient()->post($url, $salmon, [
+ 'Content-type' => 'application/magic-envelope+xml',
+ 'Content-length' => strlen($salmon)]);
$return_code = $postResult->getReturnCode();
}
return -1;
}
- if (($return_code == 503) && (stristr($postResult->getHeader(), 'retry-after'))) {
+ if (($return_code == 503) && $postResult->inHeader('retry-after')) {
return -1;
}
*/
public static function salmonKey($pubkey)
{
- Crypto::pemToMe($pubkey, $m, $e);
- return 'RSA' . '.' . Strings::base64UrlEncode($m, true) . '.' . Strings::base64UrlEncode($e, true);
+ Crypto::pemToMe($pubkey, $modulus, $exponent);
+ return 'RSA' . '.' . Strings::base64UrlEncode($modulus, true) . '.' . Strings::base64UrlEncode($exponent, true);
}
}