mirror of
https://github.com/friendica/friendica
synced 2025-05-06 15:44:11 +02:00
Warnings/Errors reduced - improved relay processing
This commit is contained in:
parent
1db70b8935
commit
ceb88c10e6
6 changed files with 74 additions and 21 deletions
|
@ -485,6 +485,31 @@ class HTTPSignature
|
|||
return $curlResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the apcontact entry of the keyId in the given header
|
||||
*
|
||||
* @param array $http_headers
|
||||
*
|
||||
* @return array APContact entry
|
||||
*/
|
||||
public static function getKeyIdContact(array $http_headers): array
|
||||
{
|
||||
if (empty($http_headers['HTTP_SIGNATURE'])) {
|
||||
Logger::debug('No HTTP_SIGNATURE header', ['header' => $http_headers]);
|
||||
return [];
|
||||
}
|
||||
|
||||
$sig_block = self::parseSigHeader($http_headers['HTTP_SIGNATURE']);
|
||||
|
||||
if (empty($sig_block['keyId'])) {
|
||||
Logger::debug('No keyId', ['sig_block' => $sig_block]);
|
||||
return [];
|
||||
}
|
||||
|
||||
$url = (strpos($sig_block['keyId'], '#') ? substr($sig_block['keyId'], 0, strpos($sig_block['keyId'], '#')) : $sig_block['keyId']);
|
||||
return APContact::getByURL($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a signer from a given HTTP request
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue