1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-22 22:30:49 +00:00

Merge pull request #1731 from math345/develop

fix bug: session id undecoded when destroy and sesssion memory provider push wrong
This commit is contained in:
astaxie 2016-03-02 13:26:57 +08:00
commit 70e63570f5
2 changed files with 5 additions and 3 deletions

View File

@ -102,7 +102,7 @@ func (pder *MemProvider) SessionRead(sid string) (Store, error) {
pder.lock.RUnlock()
pder.lock.Lock()
newsess := &MemSessionStore{sid: sid, timeAccessed: time.Now(), value: make(map[interface{}]interface{})}
element := pder.list.PushBack(newsess)
element := pder.list.PushFront(newsess)
pder.sessions[sid] = element
pder.lock.Unlock()
return newsess, nil
@ -134,7 +134,7 @@ func (pder *MemProvider) SessionRegenerate(oldsid, sid string) (Store, error) {
pder.lock.RUnlock()
pder.lock.Lock()
newsess := &MemSessionStore{sid: sid, timeAccessed: time.Now(), value: make(map[interface{}]interface{})}
element := pder.list.PushBack(newsess)
element := pder.list.PushFront(newsess)
pder.sessions[sid] = element
pder.lock.Unlock()
return newsess, nil

View File

@ -201,7 +201,9 @@ func (manager *Manager) SessionDestroy(w http.ResponseWriter, r *http.Request) {
if err != nil || cookie.Value == "" {
return
}
manager.provider.SessionDestroy(cookie.Value)
sid, _ := url.QueryUnescape(cookie.Value)
manager.provider.SessionDestroy(sid)
if manager.config.EnableSetCookie {
expiration := time.Now()
cookie = &http.Cookie{Name: manager.config.CookieName,