Switching from base64 to hex for etag

This commit is contained in:
Frederick F. Kautz IV
2015-03-16 18:38:42 -07:00
parent 211b084e50
commit 1a88b36c55
3 changed files with 4 additions and 15 deletions
+2 -6
View File
@@ -24,8 +24,6 @@ import (
"strconv"
"time"
"encoding/base64"
"encoding/hex"
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)
// common headers
writeCommonHeaders(w, metadata.ContentType)
md5Bytes, _ := hex.DecodeString(metadata.Md5)
w.Header().Set("ETag", base64.StdEncoding.EncodeToString(md5Bytes))
w.Header().Set("ETag", metadata.Md5)
w.Header().Set("Last-Modified", lastModified)
w.Header().Set("Content-Length", strconv.FormatInt(metadata.Size, 10))
w.Header().Set("Connection", "close")
@@ -76,8 +73,7 @@ func writeRangeObjectHeaders(w http.ResponseWriter, metadata mstorage.ObjectMeta
lastModified := metadata.Created.Format(time.RFC1123)
// common headers
writeCommonHeaders(w, metadata.ContentType)
md5Bytes, _ := hex.DecodeString(metadata.Md5)
w.Header().Set("ETag", base64.StdEncoding.EncodeToString(md5Bytes))
w.Header().Set("ETag", metadata.Md5)
w.Header().Set("Last-Modified", lastModified)
w.Header().Set("Content-Range", ra)
w.Header().Set("Content-Length", strconv.FormatInt(metadata.Size, 10))