mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
Add server side signaturev4 check, not wired up to the readers yet.
This commit is contained in:
@@ -54,7 +54,7 @@ type authHeader struct {
|
||||
}
|
||||
|
||||
const (
|
||||
timeFormat = "20060102T150405Z"
|
||||
iso8601Format = "20060102T150405Z"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -111,8 +111,8 @@ func parseDate(req *http.Request) (time.Time, error) {
|
||||
if _, err := time.Parse(time.RFC1123Z, amzDate); err == nil {
|
||||
return time.Parse(time.RFC1123Z, amzDate)
|
||||
}
|
||||
if _, err := time.Parse(timeFormat, amzDate); err == nil {
|
||||
return time.Parse(timeFormat, amzDate)
|
||||
if _, err := time.Parse(iso8601Format, amzDate); err == nil {
|
||||
return time.Parse(iso8601Format, amzDate)
|
||||
}
|
||||
}
|
||||
date := req.Header.Get("Date")
|
||||
@@ -124,8 +124,8 @@ func parseDate(req *http.Request) (time.Time, error) {
|
||||
if _, err := time.Parse(time.RFC1123Z, date); err == nil {
|
||||
return time.Parse(time.RFC1123Z, date)
|
||||
}
|
||||
if _, err := time.Parse(timeFormat, amzDate); err == nil {
|
||||
return time.Parse(timeFormat, amzDate)
|
||||
if _, err := time.Parse(iso8601Format, amzDate); err == nil {
|
||||
return time.Parse(iso8601Format, amzDate)
|
||||
}
|
||||
}
|
||||
return time.Time{}, errors.New("invalid request")
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
|
||||
// Reply date format
|
||||
const (
|
||||
iso8601Format = "2006-01-02T15:04:05.000Z"
|
||||
rfcFormat = "2006-01-02T15:04:05.000Z"
|
||||
)
|
||||
|
||||
// takes an array of Bucketmetadata information for serialization
|
||||
@@ -45,7 +45,7 @@ func generateListBucketsResponse(buckets []donut.BucketMetadata) ListBucketsResp
|
||||
for _, bucket := range buckets {
|
||||
var listbucket = &Bucket{}
|
||||
listbucket.Name = bucket.Name
|
||||
listbucket.CreationDate = bucket.Created.Format(iso8601Format)
|
||||
listbucket.CreationDate = bucket.Created.Format(rfcFormat)
|
||||
listbuckets = append(listbuckets, listbucket)
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ func generateListPartsResult(objectMetadata donut.ObjectResourcesMetadata) ListP
|
||||
newPart.PartNumber = part.PartNumber
|
||||
newPart.ETag = "\"" + part.ETag + "\""
|
||||
newPart.Size = part.Size
|
||||
newPart.LastModified = part.LastModified.Format(iso8601Format)
|
||||
newPart.LastModified = part.LastModified.Format(rfcFormat)
|
||||
listPartsResponse.Part = append(listPartsResponse.Part, newPart)
|
||||
}
|
||||
return listPartsResponse
|
||||
@@ -179,7 +179,7 @@ func generateListMultipartUploadsResult(bucket string, metadata donut.BucketMult
|
||||
newUpload := &Upload{}
|
||||
newUpload.UploadID = upload.UploadID
|
||||
newUpload.Key = upload.Key
|
||||
newUpload.Initiated = upload.Initiated.Format(iso8601Format)
|
||||
newUpload.Initiated = upload.Initiated.Format(rfcFormat)
|
||||
listMultipartUploadsResponse.Upload = append(listMultipartUploadsResponse.Upload, newUpload)
|
||||
}
|
||||
return listMultipartUploadsResponse
|
||||
|
||||
Reference in New Issue
Block a user