mirror of
https://github.com/kataras/iris.git
synced 2025-02-02 15:30:36 +01:00
Align sessions with the latest kataras/go-sessions. Now you should update :)
This commit is contained in:
parent
1537a657c0
commit
a073e442fc
11
README.md
11
README.md
|
@ -8,7 +8,7 @@
|
|||
|
||||
<a href="https://github.com/kataras/iris/blob/master/LICENSE"><img src="https://img.shields.io/badge/%20license-MIT%20%20License%20-E91E63.svg?style=flat-square" alt="License"></a>
|
||||
|
||||
<a href="https://github.com/kataras/iris/releases"><img src="https://img.shields.io/badge/%20release%20-%20v4.1.5%20-blue.svg?style=flat-square" alt="Releases"></a>
|
||||
<a href="https://github.com/kataras/iris/releases"><img src="https://img.shields.io/badge/%20release%20-%20v4.1.6%20-blue.svg?style=flat-square" alt="Releases"></a>
|
||||
|
||||
<a href="https://www.gitbook.com/book/kataras/iris/details"><img src="https://img.shields.io/badge/%20docs-reference-5272B4.svg?style=flat-square" alt="Practical Guide/Docs"></a><br/>
|
||||
|
||||
|
@ -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
|
||||
|
|
|
@ -2,7 +2,7 @@ package config
|
|||
|
||||
import (
|
||||
"github.com/imdario/mergo"
|
||||
"github.com/kataras/go-sessions/fasthttp"
|
||||
"github.com/kataras/go-sessions"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
21
iris.go
21
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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user