Add proper content-length for error and success responses

- All compliance issues with S3 API for Put,Get,List (Bucket,Object) respectively
 - Encodes and returns back proper HTTP headers
This commit is contained in:
Harshavardhana
2015-04-29 15:28:04 -07:00
parent c8db3e1c3b
commit 92e4301414
7 changed files with 117 additions and 64 deletions
+7 -7
View File
@@ -162,7 +162,7 @@ func (h resourceHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
writeErrorResponse(w, r, NotAcceptable, acceptsContentType, r.URL.Path)
return
}
if ignoreUnImplementedObjectResources(r) || ignoreUnImplementedBucketResources(r) {
if ignoreNotImplementedObjectResources(r) || ignoreNotImplementedBucketResources(r) {
error := getErrorCode(NotImplemented)
errorResponse := getErrorResponse(error, "")
setCommonHeaders(w, getContentTypeString(acceptsContentType))
@@ -175,22 +175,22 @@ func (h resourceHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
//// helpers
// Checks requests for unimplemented Bucket resources
func ignoreUnImplementedBucketResources(req *http.Request) bool {
// Checks requests for not implemented Bucket resources
func ignoreNotImplementedBucketResources(req *http.Request) bool {
q := req.URL.Query()
for name := range q {
if unimplementedBucketResourceNames[name] {
if notimplementedBucketResourceNames[name] {
return true
}
}
return false
}
// Checks requests for unimplemented Object resources
func ignoreUnImplementedObjectResources(req *http.Request) bool {
// Checks requests for not implemented Object resources
func ignoreNotImplementedObjectResources(req *http.Request) bool {
q := req.URL.Query()
for name := range q {
if unimplementedObjectResourceNames[name] {
if notimplementedObjectResourceNames[name] {
return true
}
}