diff --git a/CHANGELOG.md b/CHANGELOG.md index d2ab5ed77..097443189 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Updated - Updated NotificationService, fix 500 bug. ([4a609dc3](https://github.com/pixelfed/pixelfed/commit/4a609dc3)) +- Update HttpSignatures, update instance actor headers. Fixes #2935. ([a900de21](https://github.com/pixelfed/pixelfed/commit/a900de21)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.1 (2021-09-07)](https://github.com/pixelfed/pixelfed/compare/v0.11.0...v0.11.1) diff --git a/app/Services/ActivityPubFetchService.php b/app/Services/ActivityPubFetchService.php index 94e9357a3..c73e96139 100644 --- a/app/Services/ActivityPubFetchService.php +++ b/app/Services/ActivityPubFetchService.php @@ -2,7 +2,7 @@ namespace App\Services; -use Zttp\Zttp; +use Illuminate\Support\Facades\Http; use App\Profile; use App\Util\ActivityPub\Helpers; use App\Util\ActivityPub\HttpSignature; @@ -15,14 +15,13 @@ class ActivityPubFetchService return 0; } - $headers = HttpSignature::instanceActorSign($url, false, [ - 'Accept' => 'application/activity+json, application/json', - 'User-Agent' => '(Pixelfed/'.config('pixelfed.version').'; +'.config('app.url').')' - ]); + $headers = HttpSignature::instanceActorSign($url, false); + $headers['Accept'] = 'application/activity+json, application/json'; + $headers['User-Agent'] = '(Pixelfed/'.config('pixelfed.version').'; +'.config('app.url').')'; - return Zttp::withHeaders($headers) + return Http::withHeaders($headers) ->timeout(30) ->get($url) ->body(); } -} \ No newline at end of file +} diff --git a/app/Util/ActivityPub/HttpSignature.php b/app/Util/ActivityPub/HttpSignature.php index fff531fcf..792762b10 100644 --- a/app/Util/ActivityPub/HttpSignature.php +++ b/app/Util/ActivityPub/HttpSignature.php @@ -43,7 +43,7 @@ class HttpSignature { $digest = self::_digest($body); } $headers = self::_headersToSign($url, $body ? $digest : false); - $headers = array_unique(array_merge($headers, $addlHeaders)); + $headers = array_merge($headers, $addlHeaders); $stringToSign = self::_headersToSigningString($headers); $signedHeaders = implode(' ', array_map('strtolower', array_keys($headers))); $key = openssl_pkey_get_private($privateKey); @@ -133,7 +133,6 @@ class HttpSignature { 'Date' => $date->format('D, d M Y H:i:s \G\M\T'), 'Host' => parse_url($url, PHP_URL_HOST), 'Accept' => 'application/activity+json, application/json', - 'Content-Type' => 'application/activity+json' ]; if($digest) {