|
|
|
@ -33,7 +33,7 @@ type contentType int |
|
|
|
|
|
|
|
|
|
const ( |
|
|
|
|
xmlType contentType = iota |
|
|
|
|
jsonType = iota |
|
|
|
|
jsonType |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
const ( |
|
|
|
@ -65,14 +65,6 @@ func HttpHandler(storage mstorage.Storage) http.Handler { |
|
|
|
|
return mux |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func writeObjectHeaders(w http.ResponseWriter, metadata mstorage.ObjectMetadata) { |
|
|
|
|
lastModified := metadata.Created.Format(time.RFC1123) |
|
|
|
|
w.Header().Set("ETag", metadata.ETag) |
|
|
|
|
w.Header().Set("Last-Modified", lastModified) |
|
|
|
|
w.Header().Set("Content-Length", strconv.Itoa(metadata.Size)) |
|
|
|
|
w.Header().Set("Content-Type", "text/plain") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (server *minioApi) getObjectHandler(w http.ResponseWriter, req *http.Request) { |
|
|
|
|
vars := mux.Vars(req) |
|
|
|
|
bucket := vars["bucket"] |
|
|
|
@ -121,8 +113,9 @@ func (server *minioApi) headObjectHandler(w http.ResponseWriter, req *http.Reque |
|
|
|
|
|
|
|
|
|
func (server *minioApi) listBucketsHandler(w http.ResponseWriter, req *http.Request) { |
|
|
|
|
vars := mux.Vars(req) |
|
|
|
|
prefix, ok := vars["prefix"] |
|
|
|
|
if ok == false { |
|
|
|
|
var prefix string |
|
|
|
|
var ok bool |
|
|
|
|
if prefix, ok = vars["prefix"]; ok == false { |
|
|
|
|
prefix = "" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -150,17 +143,7 @@ func (server *minioApi) listBucketsHandler(w http.ResponseWriter, req *http.Requ |
|
|
|
|
|
|
|
|
|
func (server *minioApi) listObjectsHandler(w http.ResponseWriter, req *http.Request) { |
|
|
|
|
vars := mux.Vars(req) |
|
|
|
|
|
|
|
|
|
//delimiter, ok := vars["delimiter"]
|
|
|
|
|
//encodingType, ok := vars["encoding-type"]
|
|
|
|
|
//marker, ok := vars["marker"]
|
|
|
|
|
//maxKeys, ok := vars["max-keys"]
|
|
|
|
|
bucket := vars["bucket"] |
|
|
|
|
//bucket, ok := vars["bucket"]
|
|
|
|
|
//if ok == false {
|
|
|
|
|
// w.WriteHeader(http.StatusBadRequest)
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
prefix, ok := vars["prefix"] |
|
|
|
|
if ok == false { |
|
|
|
|
prefix = "" |
|
|
|
@ -213,6 +196,16 @@ func (server *minioApi) putBucketHandler(w http.ResponseWriter, req *http.Reques |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Helpers
|
|
|
|
|
|
|
|
|
|
func writeObjectHeaders(w http.ResponseWriter, metadata mstorage.ObjectMetadata) { |
|
|
|
|
lastModified := metadata.Created.Format(time.RFC1123) |
|
|
|
|
w.Header().Set("ETag", metadata.ETag) |
|
|
|
|
w.Header().Set("Last-Modified", lastModified) |
|
|
|
|
w.Header().Set("Content-Length", strconv.Itoa(metadata.Size)) |
|
|
|
|
w.Header().Set("Content-Type", "text/plain") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func generateBucketsListResult(buckets []mstorage.BucketMetadata) (data BucketListResponse) { |
|
|
|
|
var listbuckets []*Bucket |
|
|
|
|
|
|
|
|
|