Add Server, Connection into HTTP header for all API replies

master
Harshavardhana 10 years ago
parent 9e6eedfbbc
commit dfc3367e25
  1. 12
      pkg/webapi/minioapi/minioapi.go

@ -165,9 +165,13 @@ func (server *minioApi) listBucketsHandler(w http.ResponseWriter, req *http.Requ
var encoder encoder var encoder encoder
if contentType == xmlType { if contentType == xmlType {
w.Header().Set("Content-Type", "application/xml") w.Header().Set("Content-Type", "application/xml")
w.Header().Set("Server", "Minio")
w.Header().Set("Connection", "close")
encoder = xml.NewEncoder(&bytesBuffer) encoder = xml.NewEncoder(&bytesBuffer)
} else if contentType == jsonType { } else if contentType == jsonType {
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
w.Header().Set("Server", "Minio")
w.Header().Set("Connection", "close")
encoder = json.NewEncoder(&bytesBuffer) encoder = json.NewEncoder(&bytesBuffer)
} }
encoder.Encode(response) encoder.Encode(response)
@ -206,9 +210,13 @@ func (server *minioApi) listObjectsHandler(w http.ResponseWriter, req *http.Requ
var encoder encoder var encoder encoder
if contentType == xmlType { if contentType == xmlType {
w.Header().Set("Content-Type", "application/xml") w.Header().Set("Content-Type", "application/xml")
w.Header().Set("Server", "Minio")
w.Header().Set("Connection", "close")
encoder = xml.NewEncoder(&bytesBuffer) encoder = xml.NewEncoder(&bytesBuffer)
} else if contentType == jsonType { } else if contentType == jsonType {
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
w.Header().Set("Server", "Minio")
w.Header().Set("Connection", "close")
encoder = json.NewEncoder(&bytesBuffer) encoder = json.NewEncoder(&bytesBuffer)
} }
@ -247,15 +255,19 @@ func (server *minioApi) putBucketHandler(w http.ResponseWriter, req *http.Reques
w.Write([]byte(err.Error())) w.Write([]byte(err.Error()))
return return
} }
w.Header().Set("Server", "Minio")
w.Header().Set("Connection", "close")
} }
// Write Object Header helper // Write Object Header helper
func writeObjectHeaders(w http.ResponseWriter, metadata mstorage.ObjectMetadata) { func writeObjectHeaders(w http.ResponseWriter, metadata mstorage.ObjectMetadata) {
lastModified := metadata.Created.Format(time.RFC1123) lastModified := metadata.Created.Format(time.RFC1123)
w.Header().Set("ETag", metadata.ETag) w.Header().Set("ETag", metadata.ETag)
w.Header().Set("Server", "Minio")
w.Header().Set("Last-Modified", lastModified) w.Header().Set("Last-Modified", lastModified)
w.Header().Set("Content-Length", strconv.Itoa(metadata.Size)) w.Header().Set("Content-Length", strconv.Itoa(metadata.Size))
w.Header().Set("Content-Type", "text/plain") w.Header().Set("Content-Type", "text/plain")
w.Header().Set("Connection", "close")
} }
func generateBucketsListResult(buckets []mstorage.BucketMetadata) BucketListResponse { func generateBucketsListResult(buckets []mstorage.BucketMetadata) BucketListResponse {

Loading…
Cancel
Save