mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 12:40:55 +00:00
move session init before static
This commit is contained in:
parent
f8708d01bf
commit
436f9a7468
12
router.go
12
router.go
@ -459,6 +459,12 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
|
||||
context.Output = beecontext.NewOutput(rw)
|
||||
}
|
||||
|
||||
// session init
|
||||
if SessionOn {
|
||||
context.Input.CruSession = GlobalSessions.SessionStart(w, r)
|
||||
defer context.Input.CruSession.SessionRelease()
|
||||
}
|
||||
|
||||
if !utils.InSlice(strings.ToLower(r.Method), HTTPMETHOD) {
|
||||
http.Error(w, "Method Not Allowed", 405)
|
||||
goto Admin
|
||||
@ -529,12 +535,6 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
}
|
||||
|
||||
// session init after static file
|
||||
if SessionOn {
|
||||
context.Input.CruSession = GlobalSessions.SessionStart(w, r)
|
||||
defer context.Input.CruSession.SessionRelease()
|
||||
}
|
||||
|
||||
if do_filter(AfterStatic) {
|
||||
goto Admin
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user