mirror of
https://github.com/minio/minio.git
synced 2025-11-20 01:50:24 -05:00
Avoid checking date header of web requests by properly applying generic handlers (#2914)
This commit is contained in:
committed by
Harshavardhana
parent
73982c8cb6
commit
df59967f59
@@ -16,7 +16,10 @@
|
||||
|
||||
package cmd
|
||||
|
||||
import router "github.com/gorilla/mux"
|
||||
import (
|
||||
router "github.com/gorilla/mux"
|
||||
"github.com/urfave/negroni"
|
||||
)
|
||||
|
||||
// objectAPIHandler implements and provides http handlers for S3 API.
|
||||
type objectAPIHandlers struct {
|
||||
@@ -31,7 +34,7 @@ func registerAPIRouter(mux *router.Router) {
|
||||
}
|
||||
|
||||
// API Router
|
||||
apiRouter := mux.NewRoute().PathPrefix("/").Subrouter()
|
||||
apiRouter := router.NewRouter().PathPrefix("/").Subrouter()
|
||||
|
||||
// Bucket router
|
||||
bucket := apiRouter.PathPrefix("/{bucket}").Subrouter()
|
||||
@@ -96,4 +99,12 @@ func registerAPIRouter(mux *router.Router) {
|
||||
|
||||
// ListBuckets
|
||||
apiRouter.Methods("GET").HandlerFunc(api.ListBucketsHandler)
|
||||
|
||||
mux.PathPrefix("/").Handler(negroni.New(
|
||||
// Validates all incoming requests to have a valid date header.
|
||||
negroni.Wrap(timeValidityHandler{}),
|
||||
// Route requests
|
||||
negroni.Wrap(apiRouter),
|
||||
))
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user