]> git.mxchange.org Git - friendica.git/commitdiff
Better http answers
authorMichael <heluecht@pirati.ca>
Wed, 12 Sep 2018 06:01:28 +0000 (06:01 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 12 Sep 2018 06:01:28 +0000 (06:01 +0000)
src/Module/Inbox.php
src/Protocol/ActivityPub.php

index 86fdae7c90dc28ea2f0a627f1b66f7754e4f94fc..0bc78b030cf3b54eccef48529bc7262c846a558e 100644 (file)
@@ -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);
        }
 }
index f1d885b6c6474baf608c83b40c9f7c9e9c956c45..8992c525b0dafb303c8b578a8bc77df01c9b5e46 100644 (file)
@@ -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
 {