signature-v4: Support for transfer-encoding request header (#4053)

This commit is contained in:
Krishna Srinivas
2017-04-05 15:08:33 -07:00
committed by Harshavardhana
parent f205689ff5
commit af82d27018
4 changed files with 27 additions and 9 deletions

View File

@@ -107,7 +107,8 @@ func getURLEncodedName(name string) string {
}
// extractSignedHeaders extract signed headers from Authorization header
func extractSignedHeaders(signedHeaders []string, reqHeaders http.Header) (http.Header, APIErrorCode) {
func extractSignedHeaders(signedHeaders []string, r *http.Request) (http.Header, APIErrorCode) {
reqHeaders := r.Header
// find whether "host" is part of list of signed headers.
// if not return ErrUnsignedHeaders. "host" is mandatory.
if !contains(signedHeaders, "host") {
@@ -145,6 +146,10 @@ func extractSignedHeaders(signedHeaders []string, reqHeaders http.Header) (http.
if header == "host" {
continue
}
if header == "transfer-encoding" {
extractedSignedHeaders[header] = r.TransferEncoding
continue
}
// If not found continue, we will stop here.
return nil, ErrUnsignedHeaders
}