summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRoger Braun <roger@rogerbraun.net>2017-09-18 18:10:21 +0200
committerRoger Braun <roger@rogerbraun.net>2017-09-18 18:10:21 +0200
commit6268b7e0eb400c1b5e227a73e6faee0f1e476db4 (patch)
treee858d77a66b74008c6e219b947869cb7df9d4751 /lib
parent9cefbaf01625cbb4b892ce2b767f79ceb155110b (diff)
downloadpleroma-6268b7e0eb400c1b5e227a73e6faee0f1e476db4.tar.gz
pleroma-6268b7e0eb400c1b5e227a73e6faee0f1e476db4.zip
HTTP Signatures: Work with all test vectors.
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/http_signatures/http_signatures.ex6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/pleroma/web/http_signatures/http_signatures.ex b/lib/pleroma/web/http_signatures/http_signatures.ex
index e2210285e..65a344e0b 100644
--- a/lib/pleroma/web/http_signatures/http_signatures.ex
+++ b/lib/pleroma/web/http_signatures/http_signatures.ex
@@ -1,9 +1,9 @@
# https://tools.ietf.org/html/draft-cavage-http-signatures-08
defmodule Pleroma.Web.HTTPSignatures do
def split_signature(sig) do
- default = %{"headers" => ["date"]}
+ default = %{"headers" => "date"}
- sig
+ sig = sig
|> String.trim()
|> String.split(",")
|> Enum.reduce(default, fn(part, acc) ->
@@ -11,6 +11,8 @@ defmodule Pleroma.Web.HTTPSignatures do
value = Enum.join(rest, "=")
Map.put(acc, key, String.trim(value, "\""))
end)
+
+ Map.put(sig, "headers", String.split(sig["headers"], ~r/\s/))
end
def validate(headers, signature, public_key) do