fixup! v2 signer: correctly sort headers

Signed-off-by: Pierre-Yves Ritschard <pyr@spootnik.org>
This commit is contained in:
Pierre-Yves Ritschard 2016-11-02 17:07:02 +01:00
parent 775cc6d632
commit f1cf7de788

View file

@ -153,7 +153,7 @@ func (v2 *signer) Sign() error {
default: default:
if strings.HasPrefix(k, "x-amz-") { if strings.HasPrefix(k, "x-amz-") {
vall := strings.Join(v, ",") vall := strings.Join(v, ",")
smap[k] = k+":"+vall smap[k] = k + ":" + vall
if k == "x-amz-date" { if k == "x-amz-date" {
xamzDate = true xamzDate = true
date = "" date = ""
@ -164,7 +164,7 @@ func (v2 *signer) Sign() error {
} }
if len(sharray) > 0 { if len(sharray) > 0 {
sort.StringSlice(sharray).Sort() sort.StringSlice(sharray).Sort()
for _, h := range(sharray) { for _, h := range sharray {
sarray = append(sarray, smap[h]) sarray = append(sarray, smap[h])
} }
xamz = strings.Join(sarray, "\n") + "\n" xamz = strings.Join(sarray, "\n") + "\n"