From 8c07baf54b0d426d3e38d3d01aaeffd9ceb1d8f1 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 12 Sep 2018 06:01:28 +0000 Subject: [PATCH] Better http answers --- src/Module/Inbox.php | 23 +++++------------------ src/Protocol/ActivityPub.php | 3 +++ 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/Module/Inbox.php b/src/Module/Inbox.php index 86fdae7c90..0bc78b030c 100644 --- a/src/Module/Inbox.php +++ b/src/Module/Inbox.php @@ -9,6 +9,7 @@ use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Util\HTTPSignature; use Friendica\Util\Network; +use Friendica\Core\System; /** * ActivityPub Inbox @@ -18,30 +19,16 @@ class Inbox extends BaseModule public static function init() { $a = self::getApp(); - logger('Blubb: init 1'); $postdata = file_get_contents('php://input'); - $obj = json_decode($postdata); - - if (empty($obj)) { - exit(); + if (empty($postdata)) { + System::httpExit(400); } $tempfile = tempnam(get_temppath(), 'activitypub'); - file_put_contents($tempfile, json_encode(['header' => $_SERVER, 'body' => $obj])); - - logger('Blubb: init ' . $tempfile); - exit(); -// goaway($dest); - } - - public static function post() - { - $a = self::getApp(); + file_put_contents($tempfile, json_encode(['header' => $_SERVER, 'body' => $postdata])); - logger('Blubb: post'); - exit(); -// goaway($dest); + System::httpExit(200); } } diff --git a/src/Protocol/ActivityPub.php b/src/Protocol/ActivityPub.php index f1d885b6c6..8992c525b0 100644 --- a/src/Protocol/ActivityPub.php +++ b/src/Protocol/ActivityPub.php @@ -25,6 +25,9 @@ use Friendica\Content\Text\BBCode; * * https://blog.joinmastodon.org/2018/06/how-to-implement-a-basic-activitypub-server/ * https://blog.joinmastodon.org/2018/07/how-to-make-friends-and-verify-requests/ + * + * Digest: https://tools.ietf.org/html/rfc5843 + * https://tools.ietf.org/html/draft-cavage-http-signatures-10#ref-15 */ class ActivityPub { -- 2.39.5