Signature-V4: Include content-length for signature calculation. (#2643)

This is to be compatible with clients which includes content-length for signature calculation
(and hence deviating from AWS Signature-v4 spec)
This commit is contained in:
Krishna Srinivas
2016-09-09 22:08:07 +05:30
committed by Harshavardhana
parent a4afb312d4
commit 400e9309f1
3 changed files with 56 additions and 2 deletions

View File

@@ -16,7 +16,35 @@
package cmd
import "testing"
import (
"net/http"
"reflect"
"testing"
)
// Tests http.Header clone.
func TestCloneHeader(t *testing.T) {
headers := []http.Header{
http.Header{
"Content-Type": {"text/html; charset=UTF-8"},
"Content-Length": {"0"},
},
http.Header{
"Content-Length": {"0", "1", "2"},
},
http.Header{
"Expires": {"-1"},
"Content-Length": {"0"},
"Content-Encoding": {"gzip"},
},
}
for i, header := range headers {
clonedHeader := cloneHeader(header)
if !reflect.DeepEqual(header, clonedHeader) {
t.Errorf("Test %d failed", i+1)
}
}
}
// Tests maximum object size.
func TestMaxObjectSize(t *testing.T) {