aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Web/HTTPSig.php36
1 files changed, 30 insertions, 6 deletions
diff --git a/Zotlabs/Web/HTTPSig.php b/Zotlabs/Web/HTTPSig.php
index 7da9acabf..e5d73293a 100644
--- a/Zotlabs/Web/HTTPSig.php
+++ b/Zotlabs/Web/HTTPSig.php
@@ -156,6 +156,7 @@ class HTTPSig {
$cached_key = self::get_key($key, $keytype, $result['signer']);
+
if (!($cached_key && $cached_key['public_key'])) {
return $result;
}
@@ -229,21 +230,26 @@ class HTTPSig {
return ['public_key' => $key];
}
+ $deleted = false;
+ if ($keytype === 'deleted') {
+ $deleted = true;
+ }
+
if ($keytype === 'zot6') {
- $key = self::get_zotfinger_key($id, $force);
+ $key = self::get_zotfinger_key($id, $force, $deleted);
if ($key) {
return $key;
}
}
if (strpos($id, '#') === false) {
- $key = self::get_webfinger_key($id, $force);
+ $key = self::get_webfinger_key($id, $force, $deleted);
if ($key) {
return $key;
}
}
- $key = self::get_activitystreams_key($id, $force);
+ $key = self::get_activitystreams_key($id, $force, $deleted);
return $key;
@@ -274,7 +280,7 @@ class HTTPSig {
* false if no pub key found, otherwise return an array with the pub key
*/
- static function get_activitystreams_key($id, $force = false) {
+ static function get_activitystreams_key($id, $force = false, $deleted = false) {
// Check the local cache first, but remove any fragments like #main-key since these won't be present in our cached data
$url = ((strpos($id, '#')) ? substr($id, 0, strpos($id, '#')) : $id);
@@ -294,6 +300,12 @@ class HTTPSig {
}
}
+ if ($deleted) {
+ // If we received a delete and we do not have the record cached,
+ // we probably never saw this actor. Do not try to fetch it now.
+ return false;
+ }
+
// The record wasn't in cache. Fetch it now.
$r = ActivityStreams::fetch($id);
@@ -319,7 +331,7 @@ class HTTPSig {
* false if no pub key found, otherwise return an array with the pub key
*/
- static function get_webfinger_key($id, $force = false) {
+ static function get_webfinger_key($id, $force = false, $deleted = false) {
if (!$force) {
$x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_id_url = '%s' and hubloc_network in ('zot6', 'activitypub') order by hubloc_id desc",
@@ -335,6 +347,12 @@ class HTTPSig {
}
}
+ if ($deleted) {
+ // If we received a delete and we do not have the record cached,
+ // we probably never saw this actor. Do not try to fetch it now.
+ return false;
+ }
+
$wf = Webfinger::exec($id);
$key = ['portable_id' => '', 'public_key' => '', 'hubloc' => []];
@@ -366,7 +384,7 @@ class HTTPSig {
* false if no pub key found, otherwise return an array with the public key
*/
- static function get_zotfinger_key($id, $force = false) {
+ static function get_zotfinger_key($id, $force = false, $deleted = false) {
if (!$force) {
$x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_id_url = '%s' and hubloc_network = 'zot6' order by hubloc_id desc",
dbesc($id)
@@ -381,6 +399,12 @@ class HTTPSig {
}
}
+ if ($deleted) {
+ // If we received a delete and we do not have the record cached,
+ // we probably never saw this actor. Do not try to fetch it now.
+ return false;
+ }
+
$wf = Webfinger::exec($id);
$key = ['portable_id' => '', 'public_key' => '', 'hubloc' => []];