|
|
@ -251,6 +251,14 @@ type DeleteObjectsResponse struct { |
|
|
|
Errors []DeleteError `xml:"Error,omitempty"` |
|
|
|
Errors []DeleteError `xml:"Error,omitempty"` |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// PostResponse container for POST object request when success_action_status is set to 201
|
|
|
|
|
|
|
|
type PostResponse struct { |
|
|
|
|
|
|
|
Bucket string |
|
|
|
|
|
|
|
Key string |
|
|
|
|
|
|
|
ETag string |
|
|
|
|
|
|
|
Location string |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// getLocation get URL location.
|
|
|
|
// getLocation get URL location.
|
|
|
|
func getLocation(r *http.Request) string { |
|
|
|
func getLocation(r *http.Request) string { |
|
|
|
return path.Clean(r.URL.Path) // Clean any trailing slashes.
|
|
|
|
return path.Clean(r.URL.Path) // Clean any trailing slashes.
|
|
|
@ -474,21 +482,24 @@ func generateMultiDeleteResponse(quiet bool, deletedObjects []ObjectIdentifier, |
|
|
|
return deleteResp |
|
|
|
return deleteResp |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// writeSuccessResponse write success headers and response if any.
|
|
|
|
func writeResponse(w http.ResponseWriter, statusCode int, response []byte) { |
|
|
|
func writeSuccessResponse(w http.ResponseWriter, response []byte) { |
|
|
|
|
|
|
|
setCommonHeaders(w) |
|
|
|
setCommonHeaders(w) |
|
|
|
|
|
|
|
w.WriteHeader(statusCode) |
|
|
|
if response == nil { |
|
|
|
if response == nil { |
|
|
|
w.WriteHeader(http.StatusOK) |
|
|
|
|
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
w.Write(response) |
|
|
|
w.Write(response) |
|
|
|
w.(http.Flusher).Flush() |
|
|
|
w.(http.Flusher).Flush() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// writeSuccessResponse write success headers and response if any.
|
|
|
|
|
|
|
|
func writeSuccessResponse(w http.ResponseWriter, response []byte) { |
|
|
|
|
|
|
|
writeResponse(w, http.StatusOK, response) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// writeSuccessNoContent write success headers with http status 204
|
|
|
|
// writeSuccessNoContent write success headers with http status 204
|
|
|
|
func writeSuccessNoContent(w http.ResponseWriter) { |
|
|
|
func writeSuccessNoContent(w http.ResponseWriter) { |
|
|
|
setCommonHeaders(w) |
|
|
|
writeResponse(w, http.StatusNoContent, nil) |
|
|
|
w.WriteHeader(http.StatusNoContent) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// writeErrorRespone write error headers
|
|
|
|
// writeErrorRespone write error headers
|
|
|
|