diff --git a/http.go b/http.go index ae364b67..6165f3e3 100644 --- a/http.go +++ b/http.go @@ -6,6 +6,7 @@ import ( "net/http" "net/http/pprof" "os" + "sort" "strings" "sync" @@ -1217,8 +1218,9 @@ func (mux *serveMux) register(method []byte, subdomain string, path string, midd // build collects all routes info and adds them to the registry in order to be served from the request handler // this happens once when server is setting the mux's handler. func (mux *serveMux) build() { - routes := bySubdomain(mux.lookups) - for _, r := range routes { + + sort.Sort(bySubdomain(mux.lookups)) + for _, r := range mux.lookups { // add to the registry tree tree := mux.getTree(r.method, r.subdomain) if tree == nil { @@ -1260,7 +1262,6 @@ func (mux *serveMux) ServeRequest() fasthttp.RequestHandler { // initialize the router once mux.build() - // optimize this once once, we could do that: context.RequestPath(mux.escapePath), but we lose some nanoseconds on if :) getRequestPath := func(reqCtx *fasthttp.RequestCtx) string { return utils.BytesToString(reqCtx.Path()) diff --git a/plugin/iriscontrol/iriscontrol.go b/plugin/iriscontrol/iriscontrol.go index 58c8f4d6..1b393238 100644 --- a/plugin/iriscontrol/iriscontrol.go +++ b/plugin/iriscontrol/iriscontrol.go @@ -108,7 +108,10 @@ func (i *iriscontrol) initializeChild() { }) i.child.UseFunc(func(ctx *iris.Context) { - ///TODO: Remove this and make client-side basic auth when websocket connection. + ///TODO: Remove this and make client-side basic auth when websocket connection. (user@password/host.. on chronium) + // FOR GOOGLE CHROME/CHRONIUM + // https://bugs.chromium.org/p/chromium/issues/detail?id=123862 + // CROSS DOMAIN IS DISABLED so I think this is ok solution for now... if ctx.PathString() == i.child.Config.Websocket.Endpoint { ctx.Next() return diff --git a/plugin/iriscontrol/plugin.go b/plugin/iriscontrol/plugin.go index 8c451df5..77b0caa0 100644 --- a/plugin/iriscontrol/plugin.go +++ b/plugin/iriscontrol/plugin.go @@ -77,6 +77,4 @@ func (i *iriscontrol) GetDescription() string { // PreClose any clean-up // temporary is empty because all resources are cleaned graceful by the iris' station -func (i *iriscontrol) PreClose(s *iris.Framework) { - s.Logger.Infof("Main server terminated") -} +func (i *iriscontrol) PreClose(s *iris.Framework) {}