]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix invalid http signature
authorChocobozzz <me@florianbigard.com>
Fri, 15 Jul 2022 09:06:27 +0000 (11:06 +0200)
committerChocobozzz <me@florianbigard.com>
Fri, 15 Jul 2022 09:06:27 +0000 (11:06 +0200)
Date header could be inconsistent with the date included in the
signature

server/helpers/requests.ts

index 495e83558703ecfd4c2e51ce8550a21452eaa15c..0756beb16fb1c226f4f860a83a6dd8ff2f35fe2b 100644 (file)
@@ -85,11 +85,14 @@ const peertubeGot = got.extend({
           }
 
           httpSignature.signRequest({
-            getHeader: function (header) {
-              return options.headers[header]
+            getHeader: function (header: string) {
+              const value = options.headers[header.toLowerCase()]
+
+              if (!value) logger.warn('Unknown header requested by http-signature.', { headers: options.headers, header })
+              return value
             },
 
-            setHeader: function (header, value) {
+            setHeader: function (header: string, value: string) {
               options.headers[header] = value
             },