mirror of
https://github.com/minio/minio.git
synced 2025-01-26 06:03:17 -05:00
router: PathPrefix router was wrong. (#3172)
This commit is contained in:
parent
d9bab6b3bd
commit
d192044915
@ -34,7 +34,7 @@ func registerAPIRouter(mux *router.Router) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// API Router
|
// API Router
|
||||||
apiRouter := router.NewRouter().PathPrefix("/").Subrouter()
|
apiRouter := mux.NewRoute().PathPrefix("").Subrouter()
|
||||||
|
|
||||||
// Bucket router
|
// Bucket router
|
||||||
bucket := apiRouter.PathPrefix("/{bucket}").Subrouter()
|
bucket := apiRouter.PathPrefix("/{bucket}").Subrouter()
|
||||||
|
@ -187,8 +187,7 @@ func parseAmzDateHeader(req *http.Request) (time.Time, APIErrorCode) {
|
|||||||
return time.Time{}, ErrMissingDateHeader
|
return time.Time{}, ErrMissingDateHeader
|
||||||
}
|
}
|
||||||
|
|
||||||
type timeValidityHandler struct {
|
type timeValidityHandler struct{}
|
||||||
}
|
|
||||||
|
|
||||||
func (h timeValidityHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (h timeValidityHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
// Verify if date headers are set, if not reject the request
|
// Verify if date headers are set, if not reject the request
|
||||||
|
@ -453,7 +453,7 @@ func serverMain(c *cli.Context) {
|
|||||||
tls := isSSL()
|
tls := isSSL()
|
||||||
|
|
||||||
// Fetch endpoints which we are going to serve from.
|
// Fetch endpoints which we are going to serve from.
|
||||||
endPoints := finalizeEndpoints(tls, &apiServer.Server)
|
endPoints := finalizeEndpoints(tls, apiServer.Server)
|
||||||
|
|
||||||
// Initialize local server address
|
// Initialize local server address
|
||||||
globalMinioAddr = getLocalAddress(srvConfig)
|
globalMinioAddr = getLocalAddress(srvConfig)
|
||||||
|
@ -166,7 +166,7 @@ func (l *ListenerMux) Close() error {
|
|||||||
|
|
||||||
// ServerMux - the main mux server
|
// ServerMux - the main mux server
|
||||||
type ServerMux struct {
|
type ServerMux struct {
|
||||||
http.Server
|
*http.Server
|
||||||
listeners []*ListenerMux
|
listeners []*ListenerMux
|
||||||
WaitGroup *sync.WaitGroup
|
WaitGroup *sync.WaitGroup
|
||||||
GracefulTimeout time.Duration
|
GracefulTimeout time.Duration
|
||||||
@ -178,7 +178,7 @@ type ServerMux struct {
|
|||||||
// NewServerMux constructor to create a ServerMux
|
// NewServerMux constructor to create a ServerMux
|
||||||
func NewServerMux(addr string, handler http.Handler) *ServerMux {
|
func NewServerMux(addr string, handler http.Handler) *ServerMux {
|
||||||
m := &ServerMux{
|
m := &ServerMux{
|
||||||
Server: http.Server{
|
Server: &http.Server{
|
||||||
Addr: addr,
|
Addr: addr,
|
||||||
// Do not add any timeouts Golang net.Conn
|
// Do not add any timeouts Golang net.Conn
|
||||||
// closes connections right after 10mins even
|
// closes connections right after 10mins even
|
||||||
|
@ -118,7 +118,7 @@ func TestServerMux(t *testing.T) {
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
// Set the test server config to the mux
|
// Set the test server config to the mux
|
||||||
ts.Config = &m.Server
|
ts.Config = m.Server
|
||||||
ts.Start()
|
ts.Start()
|
||||||
|
|
||||||
// Create a ListenerMux
|
// Create a ListenerMux
|
||||||
@ -171,7 +171,7 @@ func TestServerCloseBlocking(t *testing.T) {
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
// Set the test server config to the mux
|
// Set the test server config to the mux
|
||||||
ts.Config = &m.Server
|
ts.Config = m.Server
|
||||||
ts.Start()
|
ts.Start()
|
||||||
|
|
||||||
// Create a ListenerMux.
|
// Create a ListenerMux.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user