From 79a2553db18c45be0fc7b838b1759dc37961bd20 Mon Sep 17 00:00:00 2001 From: Felix Sun Date: Mon, 28 May 2012 23:01:26 +0800 Subject: [PATCH] fix can't not clear session --- sessions.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sessions.go b/sessions.go index 1821e0f..6e20c9d 100644 --- a/sessions.go +++ b/sessions.go @@ -172,9 +172,12 @@ func sessionCookieValue(env Env, key string) (value string) { func cookieChanged(env Env, key, secret string) string { oldCookieValue := sessionCookieValue(env, key) value := env["mango.session"].(map[string]interface{}) - if len(value) == 0 { + + // old and new both are empty + if oldCookieValue == "" && len(value) == 0 { return "" } + newCookieValue := encodeCookie(value, secret) if oldCookieValue == newCookieValue { return ""