diff --git a/README.md b/README.md index a0a7af25..50e76af3 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ License -Releases +Releases Practical Guide/Docs
@@ -141,16 +141,13 @@ If for any personal reasons you think that Iris+fasthttp is not suitable for you ## Benchmarks -[This Benchmark suite](https://github.com/smallnest/go-web-framework-benchmark) aims to compare the whole HTTP request processing between Go web frameworks. +This Benchmark test aims to compare the whole HTTP request processing between Go web frameworks. ![Benchmark Wizzard July 21, 2016- Processing Time Horizontal Graph](https://raw.githubusercontent.com/smallnest/go-web-framework-benchmark/4db507a22c964c9bc9774c5b31afdc199a0fe8b7/benchmark.png) **The results have been updated on July 21, 2016** -[Please click here to view all detailed benchmarks.](https://github.com/smallnest/go-web-framework-benchmark/commit/4db507a22c964c9bc9774c5b31afdc199a0fe8b7) - - Testing ------------ @@ -160,7 +157,7 @@ I recommend writing your API tests using this new library, [httpexpect](https:// Versioning ------------ -Current: **v4.1.5** +Current: **v4.1.6** > Iris is an active project @@ -195,7 +192,7 @@ License can be found [here](LICENSE). [Travis]: http://travis-ci.org/kataras/iris [License Widget]: https://img.shields.io/badge/license-MIT%20%20License%20-E91E63.svg?style=flat-square [License]: https://github.com/kataras/iris/blob/master/LICENSE -[Release Widget]: https://img.shields.io/badge/release-v4.1.5-blue.svg?style=flat-square +[Release Widget]: https://img.shields.io/badge/release-v4.1.6-blue.svg?style=flat-square [Release]: https://github.com/kataras/iris/releases [Chat Widget]: https://img.shields.io/badge/community-chat-00BCD4.svg?style=flat-square [Chat]: https://kataras.rocket.chat/channel/iris diff --git a/config/sessions.go b/config/sessions.go index c6126882..75ee0792 100644 --- a/config/sessions.go +++ b/config/sessions.go @@ -2,7 +2,7 @@ package config import ( "github.com/imdario/mergo" - "github.com/kataras/go-sessions/fasthttp" + "github.com/kataras/go-sessions" "time" ) diff --git a/context.go b/context.go index 2adffba0..c3cd2735 100644 --- a/context.go +++ b/context.go @@ -961,7 +961,7 @@ func (ctx *Context) Session() sessions.Session { } if ctx.session == nil { - ctx.session = ctx.framework.sessions.Start(ctx.RequestCtx) + ctx.session = ctx.framework.sessions.StartFasthttp(ctx.RequestCtx) } return ctx.session } @@ -969,7 +969,7 @@ func (ctx *Context) Session() sessions.Session { // SessionDestroy destroys the whole session, calls the provider's destroy and remove the cookie func (ctx *Context) SessionDestroy() { if sess := ctx.Session(); sess != nil { - ctx.framework.sessions.Destroy(ctx.RequestCtx) + ctx.framework.sessions.DestroyFasthttp(ctx.RequestCtx) } } diff --git a/iris.go b/iris.go index 96c6da85..b3a4938e 100644 --- a/iris.go +++ b/iris.go @@ -63,7 +63,6 @@ import ( "github.com/kataras/go-errors" "github.com/kataras/go-fs" "github.com/kataras/go-sessions" - fasthttpSessions "github.com/kataras/go-sessions/fasthttp" "github.com/kataras/go-template" "github.com/kataras/go-template/html" "github.com/kataras/iris/config" @@ -84,7 +83,7 @@ import ( const ( // Version of the iris - Version = "4.1.5" + Version = "4.1.6" banner = ` _____ _ |_ _| (_) @@ -172,7 +171,7 @@ type ( *muxAPI contextPool *sync.Pool Config *config.Iris - sessions fasthttpSessions.Sessions + sessions sessions.Sessions responses *responseEngines templates *templateEngines // fields which are useful to the user/dev @@ -205,8 +204,11 @@ func New(cfg ...config.Iris) *Framework { responses: &responseEngines{}, Available: make(chan bool), SSH: &SSHServer{}, + // set the sessions, configuration willbe updated on the initialization also, in order to give the user the opportunity to change its config at runtime. + sessions: sessions.New(sessions.Config(c.Sessions)), } { + ///NOTE: set all with s.Config pointer // set the Logger s.Logger = logger.New(logger.DefaultConfig()) @@ -234,17 +236,9 @@ func New(cfg ...config.Iris) *Framework { return s } -func (s *Framework) initSessions() { - // set the sessions - if s.sessions == nil && s.Config.Sessions.Cookie != "" { - //set the session manager - s.sessions = fasthttpSessions.New(fasthttpSessions.Config(s.Config.Sessions)) - } -} - func (s *Framework) initialize() { - s.initSessions() + s.sessions.UpdateConfig(sessions.Config(s.Config.Sessions)) // prepare the response engines, if no response engines setted for the default content-types // then add them @@ -609,9 +603,6 @@ func UseSessionDB(db sessions.Database) { // // Note: Don't worry if no session database is registered, your context.Session will continue to work. func (s *Framework) UseSessionDB(db sessions.Database) { - if s.sessions == nil { - s.initSessions() - } s.sessions.UseDatabase(db) }