1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-08 12:31:58 +00:00

MustUse and MustUseFunc - registers middleware for all parties and subdomains - Subdomains don't care about registering order now

1st:
MustUse and MustUseFunc - registers middleware for all parties and
subdomains
2nd:
Subdomains don't care about registering order now
3rd:
iris control plugin realtime logger
This commit is contained in:
Makis Maropoulos
2016-06-17 07:18:09 +03:00
parent dde7ce31d5
commit f21faa7cfd
4 changed files with 200 additions and 45 deletions

View File

@@ -125,7 +125,7 @@ func (s *Framework) initialize() {
// listen to websocket connections
websocket.RegisterServer(s, s.Websocket, s.Logger)
// prepare the mux
// prepare the mux & the server
s.mux.setCorrectPath(!s.Config.DisablePathCorrection)
s.mux.setEscapePath(!s.Config.DisablePathEscape)
s.mux.setHostname(s.HTTPServer.VirtualHostname())
@@ -134,9 +134,6 @@ func (s *Framework) initialize() {
s.Handle(MethodGet, debugPath+"/*action", profileMiddleware(debugPath)...)
}
// prepare the server
s.HTTPServer.SetHandler(s.mux)
if s.Config.MaxRequestBodySize > 0 {
s.HTTPServer.MaxRequestBodySize = int(s.Config.MaxRequestBodySize)
}
@@ -171,6 +168,8 @@ func (s *Framework) prepareTemplates() {
func (s *Framework) openServer() (err error) {
s.initialize()
s.Plugins.DoPreListen(s)
// set the server's handler now, in order to give the chance to the plugins to add their own middlewares and routes to this station
s.HTTPServer.SetHandler(s.mux)
if err = s.HTTPServer.Open(); err == nil {
// print the banner
if !s.Config.DisableBanner {
@@ -191,3 +190,12 @@ func (s *Framework) closeServer() error {
s.Plugins.DoPreClose(s)
return s.HTTPServer.close()
}
// justServe initializes the whole framework but server doesn't listens to a specific net.Listener
func (s *Framework) justServe() *Server {
s.initialize()
s.Plugins.DoPreListen(s)
s.HTTPServer.SetHandler(s.mux)
s.Plugins.DoPostListen(s)
return s.HTTPServer
}