mirror of
https://github.com/minio/minio.git
synced 2025-01-12 15:33:22 -05:00
Merge pull request #311 from fkautz/pr_out_switching_from_base64_to_hex_for_etag
This commit is contained in:
commit
d99435963b
@ -32,8 +32,6 @@ import (
|
|||||||
mstorage "github.com/minio-io/minio/pkg/storage"
|
mstorage "github.com/minio-io/minio/pkg/storage"
|
||||||
"github.com/minio-io/minio/pkg/storage/memory"
|
"github.com/minio-io/minio/pkg/storage/memory"
|
||||||
|
|
||||||
"encoding/base64"
|
|
||||||
"encoding/hex"
|
|
||||||
. "gopkg.in/check.v1"
|
. "gopkg.in/check.v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -364,10 +362,7 @@ func (s *MySuite) TestDateFormat(c *C) {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
func verifyHeaders(c *C, header http.Header, date time.Time, size int, contentType string, md5String string) {
|
func verifyHeaders(c *C, header http.Header, date time.Time, size int, contentType string, etag string) {
|
||||||
md5Sum, err := hex.DecodeString(md5String)
|
|
||||||
etag := base64.StdEncoding.EncodeToString(md5Sum)
|
|
||||||
c.Assert(err, IsNil)
|
|
||||||
// Verify date
|
// Verify date
|
||||||
c.Assert(header.Get("Last-Modified"), Equals, date.Format(time.RFC1123))
|
c.Assert(header.Get("Last-Modified"), Equals, date.Format(time.RFC1123))
|
||||||
|
|
||||||
|
@ -24,8 +24,6 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"encoding/base64"
|
|
||||||
"encoding/hex"
|
|
||||||
mstorage "github.com/minio-io/minio/pkg/storage"
|
mstorage "github.com/minio-io/minio/pkg/storage"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -64,8 +62,7 @@ func writeObjectHeaders(w http.ResponseWriter, metadata mstorage.ObjectMetadata)
|
|||||||
lastModified := metadata.Created.Format(time.RFC1123)
|
lastModified := metadata.Created.Format(time.RFC1123)
|
||||||
// common headers
|
// common headers
|
||||||
writeCommonHeaders(w, metadata.ContentType)
|
writeCommonHeaders(w, metadata.ContentType)
|
||||||
md5Bytes, _ := hex.DecodeString(metadata.Md5)
|
w.Header().Set("ETag", metadata.Md5)
|
||||||
w.Header().Set("ETag", base64.StdEncoding.EncodeToString(md5Bytes))
|
|
||||||
w.Header().Set("Last-Modified", lastModified)
|
w.Header().Set("Last-Modified", lastModified)
|
||||||
w.Header().Set("Content-Length", strconv.FormatInt(metadata.Size, 10))
|
w.Header().Set("Content-Length", strconv.FormatInt(metadata.Size, 10))
|
||||||
w.Header().Set("Connection", "close")
|
w.Header().Set("Connection", "close")
|
||||||
@ -76,8 +73,7 @@ func writeRangeObjectHeaders(w http.ResponseWriter, metadata mstorage.ObjectMeta
|
|||||||
lastModified := metadata.Created.Format(time.RFC1123)
|
lastModified := metadata.Created.Format(time.RFC1123)
|
||||||
// common headers
|
// common headers
|
||||||
writeCommonHeaders(w, metadata.ContentType)
|
writeCommonHeaders(w, metadata.ContentType)
|
||||||
md5Bytes, _ := hex.DecodeString(metadata.Md5)
|
w.Header().Set("ETag", metadata.Md5)
|
||||||
w.Header().Set("ETag", base64.StdEncoding.EncodeToString(md5Bytes))
|
|
||||||
w.Header().Set("Last-Modified", lastModified)
|
w.Header().Set("Last-Modified", lastModified)
|
||||||
w.Header().Set("Content-Range", ra)
|
w.Header().Set("Content-Range", ra)
|
||||||
w.Header().Set("Content-Length", strconv.FormatInt(metadata.Size, 10))
|
w.Header().Set("Content-Length", strconv.FormatInt(metadata.Size, 10))
|
||||||
|
@ -19,7 +19,6 @@ package minioapi
|
|||||||
import (
|
import (
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"encoding/hex"
|
|
||||||
mstorage "github.com/minio-io/minio/pkg/storage"
|
mstorage "github.com/minio-io/minio/pkg/storage"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -90,8 +89,7 @@ func generateObjectsListResult(bucket string, objects []mstorage.ObjectMetadata,
|
|||||||
}
|
}
|
||||||
content.Key = object.Key
|
content.Key = object.Key
|
||||||
content.LastModified = object.Created.Format(iso8601Format)
|
content.LastModified = object.Created.Format(iso8601Format)
|
||||||
md5Bytes, _ := hex.DecodeString(object.Md5)
|
content.ETag = object.Md5
|
||||||
content.ETag = hex.EncodeToString(md5Bytes)
|
|
||||||
content.Size = object.Size
|
content.Size = object.Size
|
||||||
content.StorageClass = "STANDARD"
|
content.StorageClass = "STANDARD"
|
||||||
content.Owner = owner
|
content.Owner = owner
|
||||||
|
Loading…
Reference in New Issue
Block a user