Use http.TimeFormat to return, S3 expects us to return in GMT not UTC

master
Harshavardhana 10 years ago
parent 4b22a90182
commit e46660a966
  1. 4
      pkg/api/api_test.go
  2. 5
      pkg/api/headers.go

@ -894,7 +894,7 @@ func (s *MySuite) TestDateFormat(c *C) {
func verifyHeaders(c *C, header http.Header, date time.Time, size int, contentType string, etag string) { func verifyHeaders(c *C, header http.Header, date time.Time, size int, contentType string, etag string) {
// Verify date // Verify date
c.Assert(header.Get("Last-Modified"), Equals, date.Format(time.RFC1123)) c.Assert(header.Get("Last-Modified"), Equals, date.Format(http.TimeFormat))
// verify size // verify size
c.Assert(header.Get("Content-Length"), Equals, strconv.Itoa(size)) c.Assert(header.Get("Content-Length"), Equals, strconv.Itoa(size))
@ -903,7 +903,7 @@ func verifyHeaders(c *C, header http.Header, date time.Time, size int, contentTy
c.Assert(header.Get("Content-Type"), Equals, contentType) c.Assert(header.Get("Content-Type"), Equals, contentType)
// verify etag // verify etag
c.Assert(header.Get("Etag"), Equals, etag) c.Assert(header.Get("Etag"), Equals, "\""+etag+"\"")
} }
func (s *MySuite) TestXMLNameNotInBucketListJson(c *C) { func (s *MySuite) TestXMLNameNotInBucketListJson(c *C) {

@ -22,7 +22,6 @@ import (
"encoding/xml" "encoding/xml"
"net/http" "net/http"
"strconv" "strconv"
"time"
"github.com/minio/minio/pkg/storage/drivers" "github.com/minio/minio/pkg/storage/drivers"
) )
@ -64,11 +63,11 @@ func encodeErrorResponse(response interface{}, acceptsType contentType) []byte {
// Write object header // Write object header
func setObjectHeaders(w http.ResponseWriter, metadata drivers.ObjectMetadata) { func setObjectHeaders(w http.ResponseWriter, metadata drivers.ObjectMetadata) {
lastModified := metadata.Created.Format(time.RFC1123) lastModified := metadata.Created.Format(http.TimeFormat)
// common headers // common headers
setCommonHeaders(w, metadata.ContentType, int(metadata.Size)) setCommonHeaders(w, metadata.ContentType, int(metadata.Size))
// object related headers // object related headers
w.Header().Set("ETag", metadata.Md5) w.Header().Set("ETag", "\""+metadata.Md5+"\"")
w.Header().Set("Last-Modified", lastModified) w.Header().Set("Last-Modified", lastModified)
} }

Loading…
Cancel
Save