]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/activitypub.ts
Fix CPU usage on PostgreSQL
[github/Chocobozzz/PeerTube.git] / server / middlewares / activitypub.ts
index fedac0e05ed419b2de6c0b37ee3ddb02840715ec..c6d8466acda03abe664ab89a739f83d05053e0f7 100644 (file)
@@ -51,9 +51,9 @@ export {
 // ---------------------------------------------------------------------------
 
 async function checkHttpSignature (req: Request, res: Response) {
-  // FIXME: mastodon does not include the Signature scheme
+  // FIXME: compatibility with http-signature < v1.3
   const sig = req.headers[HTTP_SIGNATURE.HEADER_NAME] as string
-  if (sig && sig.startsWith('Signature ') === false) req.headers[HTTP_SIGNATURE.HEADER_NAME] = 'Signature ' + sig
+  if (sig && sig.startsWith('Signature ') === true) req.headers[HTTP_SIGNATURE.HEADER_NAME] = sig.replace(/^Signature /, '')
 
   const parsed = parseHTTPSignature(req, HTTP_SIGNATURE.CLOCK_SKEW_SECONDS)