d014ccfb by Pengfei Xue

bug fix, session stored in redis cannot be deleted

1 parent 1509a6b6
...@@ -398,6 +398,7 @@ func (c *Controller) SessionRegenerateID() { ...@@ -398,6 +398,7 @@ func (c *Controller) SessionRegenerateID() {
398 398
399 // DestroySession cleans session data and session cookie. 399 // DestroySession cleans session data and session cookie.
400 func (c *Controller) DestroySession() { 400 func (c *Controller) DestroySession() {
401 c.Ctx.Input.CruSession.Flush()
401 GlobalSessions.SessionDestroy(c.Ctx.ResponseWriter, c.Ctx.Request) 402 GlobalSessions.SessionDestroy(c.Ctx.ResponseWriter, c.Ctx.Request)
402 } 403 }
403 404
......
...@@ -60,6 +60,11 @@ func (rs *RedisSessionStore) SessionID() string { ...@@ -60,6 +60,11 @@ func (rs *RedisSessionStore) SessionID() string {
60 } 60 }
61 61
62 func (rs *RedisSessionStore) SessionRelease(w http.ResponseWriter) { 62 func (rs *RedisSessionStore) SessionRelease(w http.ResponseWriter) {
63 // if rs.values is empty, return directly
64 if len(rs.values) < 1 {
65 return
66 }
67
63 c := rs.p.Get() 68 c := rs.p.Get()
64 defer c.Close() 69 defer c.Close()
65 70
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!