]> git.ipfire.org Git - thirdparty/curl.git/commit
aws_sigv4: fix header computation
authorMatthias Gatto <matthias.gatto@outscale.com>
Thu, 13 Jan 2022 14:53:52 +0000 (15:53 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 11 Oct 2022 12:33:46 +0000 (14:33 +0200)
commit29c4aa00a16872514eb2e2c639576a382ffb66d3
treed2535de68a4f65082a738807258372b7535f8071
parent3c0050d13e69eb64f500114481cffaeb0e0363ff
aws_sigv4: fix header computation

Handle canonical headers and signed headers creation as explained here:
https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html

The algo tells that signed and canonical must contain at last host and
x-amz-date.

So we check whatever thoses are present in the curl http headers list.
If they are, we use the one enter by curl user, otherwise we generate
them.  then we to lower, and remove space from each http headers plus
host and x-amz-date, then sort them all by alphabetical order.

This patch also fix a bug with host header, which was ignoring the port.

Closes #7966
17 files changed:
lib/http_aws_sigv4.c
tests/data/Makefile.inc
tests/data/test1933
tests/data/test1934
tests/data/test1935
tests/data/test1936
tests/data/test1937
tests/data/test1938
tests/data/test1955 [new file with mode: 0644]
tests/libtest/Makefile.inc
tests/libtest/lib1933.c
tests/libtest/lib1934.c
tests/libtest/lib1935.c
tests/libtest/lib1936.c
tests/libtest/lib1937.c
tests/libtest/lib1938.c
tests/libtest/lib1955.c [new file with mode: 0644]