mirror of
https://github.com/minio/minio.git
synced 2025-11-10 05:59:43 -05:00
sign/streaming: Content-Encoding is not set in newer aws-java-sdks (#3986)
We can't use Content-Encoding to verify if `aws-chunked` is set or not. Just use 'streaming' signature header instead. While this is considered mandatory, on the contrary aws-sdk-java doesn't set this value http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-streaming.html ``` Set the value to aws-chunked. ``` We will relax it and behave appropriately. Also this PR supports saving custom encoding after trimming off the `aws-chunked` parameter. Fixes #3983
This commit is contained in:
@@ -158,6 +158,23 @@ func extractReqParams(r *http.Request) map[string]string {
|
||||
}
|
||||
}
|
||||
|
||||
// Trims away `aws-chunked` from the content-encoding header if present.
|
||||
// Streaming signature clients can have custom content-encoding such as
|
||||
// `aws-chunked,gzip` here we need to only save `gzip`.
|
||||
// For more refer http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-streaming.html
|
||||
func trimAwsChunkedContentEncoding(contentEnc string) (trimmedContentEnc string) {
|
||||
if contentEnc == "" {
|
||||
return contentEnc
|
||||
}
|
||||
var newEncs []string
|
||||
for _, enc := range strings.Split(contentEnc, ",") {
|
||||
if enc != streamingContentEncoding {
|
||||
newEncs = append(newEncs, enc)
|
||||
}
|
||||
}
|
||||
return strings.Join(newEncs, ",")
|
||||
}
|
||||
|
||||
// extractMetadataFromForm extracts metadata from Post Form.
|
||||
func extractMetadataFromForm(formValues http.Header) map[string]string {
|
||||
return extractMetadataFromHeader(formValues)
|
||||
|
||||
Reference in New Issue
Block a user