mirror of
https://github.com/minio/minio.git
synced 2025-11-09 05:34:56 -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:
@@ -828,6 +828,25 @@ func newTestStreamingSignedBadChunkDateRequest(method, urlStr string, contentLen
|
||||
return req, err
|
||||
}
|
||||
|
||||
func newTestStreamingSignedCustomEncodingRequest(method, urlStr string, contentLength, chunkSize int64, body io.ReadSeeker, accessKey, secretKey, contentEncoding string) (*http.Request, error) {
|
||||
req, err := newTestStreamingRequest(method, urlStr, contentLength, chunkSize, body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Set custom encoding.
|
||||
req.Header.Set("content-encoding", contentEncoding)
|
||||
|
||||
currTime := UTCNow()
|
||||
signature, err := signStreamingRequest(req, accessKey, secretKey, currTime)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
req, err = assembleStreamingChunks(req, body, chunkSize, secretKey, signature, currTime)
|
||||
return req, err
|
||||
}
|
||||
|
||||
// Returns new HTTP request object signed with streaming signature v4.
|
||||
func newTestStreamingSignedRequest(method, urlStr string, contentLength, chunkSize int64, body io.ReadSeeker, accessKey, secretKey string) (*http.Request, error) {
|
||||
req, err := newTestStreamingRequest(method, urlStr, contentLength, chunkSize, body)
|
||||
|
||||
Reference in New Issue
Block a user