server: Validate path for bad components in a handler. (#4170)

This commit is contained in:
Harshavardhana
2017-04-24 18:13:46 -07:00
committed by Minio Trusted
parent 6e7d33df20
commit 058ea84605
11 changed files with 138 additions and 12 deletions
+7 -6
View File
@@ -338,7 +338,7 @@ func StartTestServer(t TestErrHandler, instanceType string) TestServer {
// The object Layer will be a temp back used for testing purpose.
func initTestStorageRPCEndPoint(srvCmdConfig serverCmdConfig) http.Handler {
// Initialize router.
muxRouter := router.NewRouter()
muxRouter := router.NewRouter().SkipClean(true)
registerStorageRPCRouters(muxRouter, srvCmdConfig)
return muxRouter
}
@@ -421,7 +421,8 @@ func StartTestPeersRPCServer(t TestErrHandler, instanceType string) TestServer {
endpoints: endpoints,
}
mux := router.NewRouter()
mux := router.NewRouter().SkipClean(true)
// need storage layer for bucket config storage.
registerStorageRPCRouters(mux, srvCfg)
// need API layer to send requests, etc.
@@ -2182,7 +2183,7 @@ func registerAPIFunctions(muxRouter *router.Router, objLayer ObjectLayer, apiFun
func initTestAPIEndPoints(objLayer ObjectLayer, apiFunctions []string) http.Handler {
// initialize a new mux router.
// goriilla/mux is the library used to register all the routes and handle them.
muxRouter := router.NewRouter()
muxRouter := router.NewRouter().SkipClean(true)
if len(apiFunctions) > 0 {
// Iterate the list of API functions requested for and register them in mux HTTP handler.
registerAPIFunctions(muxRouter, objLayer, apiFunctions...)
@@ -2199,7 +2200,7 @@ func initTestWebRPCEndPoint(objLayer ObjectLayer) http.Handler {
globalObjLayerMutex.Unlock()
// Initialize router.
muxRouter := router.NewRouter()
muxRouter := router.NewRouter().SkipClean(true)
registerWebRouter(muxRouter)
return muxRouter
}
@@ -2207,7 +2208,7 @@ func initTestWebRPCEndPoint(objLayer ObjectLayer) http.Handler {
// Initialize browser RPC endpoint.
func initTestBrowserPeerRPCEndPoint() http.Handler {
// Initialize router.
muxRouter := router.NewRouter()
muxRouter := router.NewRouter().SkipClean(true)
registerBrowserPeerRPCRouter(muxRouter)
return muxRouter
}
@@ -2261,7 +2262,7 @@ func StartTestS3PeerRPCServer(t TestErrHandler) (TestServer, []string) {
globalObjLayerMutex.Unlock()
// Register router on a new mux
muxRouter := router.NewRouter()
muxRouter := router.NewRouter().SkipClean(true)
err = registerS3PeerRPCRouter(muxRouter)
if err != nil {
t.Fatalf("%s", err)