1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 14:00:54 +00:00
This commit is contained in:
astaxie 2014-01-05 15:21:50 +08:00
parent 9cbd475701
commit 31bdb793cf
2 changed files with 6 additions and 5 deletions

View File

@ -4,6 +4,7 @@ import (
"net/http"
"path"
"path/filepath"
"strconv"
"strings"
"github.com/astaxie/beego/middleware"
@ -194,13 +195,13 @@ func Run() {
sessionConfig := AppConfig.String("sessionConfig")
if sessionConfig == "" {
sessionConfig = `{"cookieName":` + SessionName + `,` +
`"gclifetime":` + SessionGCMaxLifetime + `,` +
`"gclifetime":` + strconv.FormatInt(SessionGCMaxLifetime, 10) + `,` +
`"providerConfig":` + SessionSavePath + `,` +
`"secure":` + HttpTLS + `,` +
`"secure":` + strconv.FormatBool(HttpTLS) + `,` +
`"sessionIDHashFunc":` + SessionHashFunc + `,` +
`"sessionIDHashKey":` + SessionHashKey + `,` +
`"enableSetCookie":` + SessionAutoSetCookie + `,` +
`"cookieLifeTime":` + SessionCookieLifeTime + `,}`
`"enableSetCookie":` + strconv.FormatBool(SessionAutoSetCookie) + `,` +
`"cookieLifeTime":` + strconv.Itoa(SessionCookieLifeTime) + `,}`
}
GlobalSessions, _ = session.NewManager(SessionProvider,
sessionConfig)

View File

@ -529,7 +529,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
// session init
if SessionOn {
context.Input.CruSession = GlobalSessions.SessionStart(w, r)
defer context.Input.CruSession.SessionRelease()
defer context.Input.CruSession.SessionRelease(w)
}
if !utils.InSlice(strings.ToLower(r.Method), HTTPMETHOD) {