Merge pull request #1251 from harshavardhana/fix-bug
signature: Fix a bug in signature v2
This commit is contained in:
+1
@@ -11,6 +11,7 @@ List of supported cloud storage providers.
|
||||
- Minio
|
||||
|
||||
- AWS Signature Version 2
|
||||
- Google Cloud Storage (Compatibility Mode)
|
||||
- Openstack Swift + Swift3 middleware
|
||||
- Ceph Object Gateway
|
||||
- Riak CS
|
||||
|
||||
+3
-3
@@ -97,7 +97,7 @@ func (r *Request) PostPresignSignatureV2(policyBase64 string) string {
|
||||
func (r *Request) SignV2() {
|
||||
// Add date if not present.
|
||||
if date := r.Get("Date"); date == "" {
|
||||
r.Set("X-Amz-Date", time.Now().UTC().Format(http.TimeFormat))
|
||||
r.Set("Date", time.Now().UTC().Format(http.TimeFormat))
|
||||
}
|
||||
// Calculate HMAC for secretAccessKey.
|
||||
hm := hmac.New(sha1.New, []byte(r.config.SecretAccessKey))
|
||||
@@ -119,7 +119,7 @@ func (r *Request) SignV2() {
|
||||
// StringToSign = HTTP-Verb + "\n" +
|
||||
// Content-MD5 + "\n" +
|
||||
// Content-Type + "\n" +
|
||||
// Date(X-Amz-Date) + "\n" +
|
||||
// Date + "\n" +
|
||||
// CanonicalizedProtocolHeaders +
|
||||
// CanonicalizedResource;
|
||||
func (r *Request) getStringToSignV2() string {
|
||||
@@ -141,7 +141,7 @@ func (r *Request) writeDefaultHeaders(buf *bytes.Buffer) {
|
||||
buf.WriteByte('\n')
|
||||
buf.WriteString(r.req.Header.Get("Content-Type"))
|
||||
buf.WriteByte('\n')
|
||||
buf.WriteString(r.req.Header.Get("X-Amz-Date"))
|
||||
buf.WriteString(r.req.Header.Get("Date"))
|
||||
buf.WriteByte('\n')
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -29,8 +29,8 @@
|
||||
},
|
||||
{
|
||||
"path": "github.com/minio/minio-go",
|
||||
"revision": "4038ad42792060c25e80badf20ea8f5fd24da28b",
|
||||
"revisionTime": "2015-11-09T21:12:17-08:00"
|
||||
"revision": "dfaef18b7534616567ab84edf267b1684f2b4b03",
|
||||
"revisionTime": "2015-11-10T00:25:04-08:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/minio/minio-xl/pkg/probe",
|
||||
|
||||
Reference in New Issue
Block a user