From 31bdb793cf9bf1698ecaf485561979acc66abad7 Mon Sep 17 00:00:00 2001 From: astaxie Date: Sun, 5 Jan 2014 15:21:50 +0800 Subject: [PATCH] make fix --- beego.go | 9 +++++---- router.go | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/beego.go b/beego.go index 586ea5b4..d672e834 100644 --- a/beego.go +++ b/beego.go @@ -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) diff --git a/router.go b/router.go index f7c92ce7..fce3885b 100644 --- a/router.go +++ b/router.go @@ -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) {