Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/aws_auth/authorization_header.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ defmodule AWSAuth.AuthorizationHeader do

headers = Map.put_new(headers, "host", uri.host)

payload = AWSAuth.Utils.hash_sha256(payload)
payload = if payload == :hashed do
payload
else
AWSAuth.Utils.hash_sha256(payload)
end

headers = Map.put_new(headers, "x-amz-content-sha256", payload)

Expand Down
8 changes: 5 additions & 3 deletions lib/aws_auth/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ defmodule AWSAuth.Utils do
|> Enum.sort(&(&1 < &2))
|> Enum.join(";")

hashed_payload = if hashed_payload == :unsigned,
do: "UNSIGNED-PAYLOAD",
else: hashed_payload
hashed_payload = case hashed_payload do
:unsigned -> "UNSIGNED-PAYLOAD"
:hashed -> headers["x-amz-content-sha256"]
_ -> hashed_payload
end

encoded_path =
path
Expand Down