Commit 436f9a74 authored by astaxie's avatar astaxie

move session init before static

parent f8708d01
...@@ -459,6 +459,12 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) ...@@ -459,6 +459,12 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
context.Output = beecontext.NewOutput(rw) 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) { if !utils.InSlice(strings.ToLower(r.Method), HTTPMETHOD) {
http.Error(w, "Method Not Allowed", 405) http.Error(w, "Method Not Allowed", 405)
goto Admin goto Admin
...@@ -529,12 +535,6 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) ...@@ -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) { if do_filter(AfterStatic) {
goto Admin goto Admin
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment