aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Web/HTTPSig.php
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Web/HTTPSig.php')
-rw-r--r--Zotlabs/Web/HTTPSig.php23
1 files changed, 19 insertions, 4 deletions
diff --git a/Zotlabs/Web/HTTPSig.php b/Zotlabs/Web/HTTPSig.php
index 7da9acabf..660fdc4ce 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;
}
@@ -243,7 +244,12 @@ class HTTPSig {
}
}
- $key = self::get_activitystreams_key($id, $force);
+ $delete = false;
+ if ($keytype === 'delete') {
+ $delete = true;
+ }
+
+ $key = self::get_activitystreams_key($id, $force, $delete);
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, $delete = 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 ($delete) {
+ // 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);
@@ -516,11 +528,14 @@ class HTTPSig {
if ($head) {
foreach ($head as $k => $v) {
- $headers .= strtolower($k) . ': ' . trim($v) . "\n";
+ $k = strtolower($k);
+ $v = (($v) ? trim($v) : '');
+
+ $headers .= $k . ': ' . $v . "\n";
if ($fields)
$fields .= ' ';
- $fields .= strtolower($k);
+ $fields .= $k;
}
// strip the trailing linefeed
$headers = rtrim($headers, "\n");