4a3d32dc by astaxie

support auto get session from input fix #211

1 parent 048be29f
...@@ -270,7 +270,7 @@ func (c *Controller) SaveToFile(fromfile, tofile string) error { ...@@ -270,7 +270,7 @@ func (c *Controller) SaveToFile(fromfile, tofile string) error {
270 270
271 func (c *Controller) StartSession() session.SessionStore { 271 func (c *Controller) StartSession() session.SessionStore {
272 if c.CruSession == nil { 272 if c.CruSession == nil {
273 c.CruSession = GlobalSessions.SessionStart(c.Ctx.ResponseWriter, c.Ctx.Request) 273 c.CruSession = c.Ctx.Input.CruSession
274 } 274 }
275 return c.CruSession 275 return c.CruSession
276 } 276 }
......
...@@ -306,6 +306,10 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) ...@@ -306,6 +306,10 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
306 context.Output = beecontext.NewOutput(rw) 306 context.Output = beecontext.NewOutput(rw)
307 } 307 }
308 308
309 if SessionOn {
310 context.Input.CruSession = GlobalSessions.SessionStart(w, r)
311 }
312
309 var runrouter *controllerInfo 313 var runrouter *controllerInfo
310 var findrouter bool 314 var findrouter bool
311 315
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!