Add proper router for handling putBucketACLHandler

This commit is contained in:
Harshavardhana
2015-10-07 20:36:36 -07:00
parent e719adec8b
commit d18ca4b40d
7 changed files with 29 additions and 31 deletions
+15 -3
View File
@@ -19,6 +19,7 @@ package main
import (
"errors"
"net/http"
"strings"
"time"
"github.com/rs/cors"
@@ -113,9 +114,20 @@ func IgnoreResourcesHandler(h http.Handler) http.Handler {
// Resource handler ServeHTTP() wrapper
func (h resourceHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if ignoreNotImplementedObjectResources(r) || ignoreNotImplementedBucketResources(r) {
writeErrorResponse(w, r, NotImplemented, r.URL.Path)
return
splits := strings.SplitN(r.URL.Path, "/", 3)
switch len(splits) {
// bucket exists
case 2:
if ignoreNotImplementedBucketResources(r) {
writeErrorResponse(w, r, NotImplemented, r.URL.Path)
return
}
// object exists
case 3:
if ignoreNotImplementedObjectResources(r) {
writeErrorResponse(w, r, NotImplemented, r.URL.Path)
return
}
}
h.handler.ServeHTTP(w, r)
}