]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/HTTPSignature.php
Standards
[friendica.git] / src / Util / HTTPSignature.php
index 36919b5b64f0273dac38089d09f6fe597562c151..3e22820e5c4e96349035b8561c8773e147d15285 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -28,9 +28,7 @@ use Friendica\DI;
 use Friendica\Model\APContact;
 use Friendica\Model\Contact;
 use Friendica\Model\User;
-use Friendica\Network\HTTPClient\Response\CurlResult;
 use Friendica\Network\HTTPClient\Client\HttpClientOptions;
-use Friendica\Network\HTTPClient\Capability\ICanHandleHttpResponses;
 
 /**
  * Implements HTTP Signatures per draft-cavage-http-signatures-07.
@@ -66,7 +64,7 @@ class HTTPSignature
 
                // Decide if $data arrived via controller submission or curl.
                $headers = [];
-               $headers['(request-target)'] = strtolower($_SERVER['REQUEST_METHOD']).' '.$_SERVER['REQUEST_URI'];
+               $headers['(request-target)'] = strtolower(DI::args()->getMethod()).' '.$_SERVER['REQUEST_URI'];
 
                foreach ($_SERVER as $k => $v) {
                        if (strpos($k, 'HTTP_') === 0) {
@@ -417,7 +415,7 @@ class HTTPSignature
         * @return \Friendica\Network\HTTPClient\Capability\ICanHandleHttpResponses CurlResult
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
-       public static function fetchRaw($request, $uid = 0, $opts = ['accept_content' => ['application/activity+json', 'application/ld+json']])
+       public static function fetchRaw($request, $uid = 0, $opts = ['accept_content' => ['application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams"']])
        {
                $header = [];
 
@@ -476,7 +474,7 @@ class HTTPSignature
        public static function getSigner($content, $http_headers)
        {
                if (empty($http_headers['HTTP_SIGNATURE'])) {
-                       Logger::info('No HTTP_SIGNATURE header');
+                       Logger::debug('No HTTP_SIGNATURE header');
                        return false;
                }
 
@@ -493,7 +491,7 @@ class HTTPSignature
                }
 
                $headers = [];
-               $headers['(request-target)'] = strtolower($http_headers['REQUEST_METHOD']) . ' ' . parse_url($http_headers['REQUEST_URI'], PHP_URL_PATH);
+               $headers['(request-target)'] = strtolower(DI::args()->getMethod()) . ' ' . parse_url($http_headers['REQUEST_URI'], PHP_URL_PATH);
 
                // First take every header
                foreach ($http_headers as $k => $v) {