mirror of
https://github.com/astaxie/beego.git
synced 2024-11-26 08:11:29 +00:00
Merge branch 'develop' of https://github.com/astaxie/beego into develop
This commit is contained in:
commit
9d0798edc6
@ -75,12 +75,6 @@ func (cs *CouchbaseSessionStore) SessionID() string {
|
|||||||
func (cs *CouchbaseSessionStore) SessionRelease(w http.ResponseWriter) {
|
func (cs *CouchbaseSessionStore) SessionRelease(w http.ResponseWriter) {
|
||||||
defer cs.b.Close()
|
defer cs.b.Close()
|
||||||
|
|
||||||
// if rs.values is empty, return directly
|
|
||||||
if len(cs.values) < 1 {
|
|
||||||
cs.b.Delete(cs.sid)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
bo, err := session.EncodeGob(cs.values)
|
bo, err := session.EncodeGob(cs.values)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
@ -72,11 +72,6 @@ func (rs *MemcacheSessionStore) SessionID() string {
|
|||||||
// save session values to redis
|
// save session values to redis
|
||||||
func (rs *MemcacheSessionStore) SessionRelease(w http.ResponseWriter) {
|
func (rs *MemcacheSessionStore) SessionRelease(w http.ResponseWriter) {
|
||||||
defer rs.c.Close()
|
defer rs.c.Close()
|
||||||
// if rs.values is empty, return directly
|
|
||||||
if len(rs.values) < 1 {
|
|
||||||
rs.c.Delete(rs.sid)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
b, err := session.EncodeGob(rs.values)
|
b, err := session.EncodeGob(rs.values)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -81,12 +81,6 @@ func (rs *RedisSessionStore) SessionRelease(w http.ResponseWriter) {
|
|||||||
c := rs.p.Get()
|
c := rs.p.Get()
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
// if rs.values is empty, return directly
|
|
||||||
if len(rs.values) < 1 {
|
|
||||||
c.Do("DEL", rs.sid)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
b, err := session.EncodeGob(rs.values)
|
b, err := session.EncodeGob(rs.values)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
@ -27,11 +27,14 @@ func serverStaticRouter(ctx *context.Context) {
|
|||||||
if len(prefix) == 0 {
|
if len(prefix) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if requestPath == "/favicon.ico" {
|
if requestPath == "/favicon.ico" || requestPath == "/robots.txt" {
|
||||||
file := path.Join(staticDir, requestPath)
|
file := path.Join(staticDir, requestPath)
|
||||||
if utils.FileExists(file) {
|
if utils.FileExists(file) {
|
||||||
http.ServeFile(ctx.ResponseWriter, ctx.Request, file)
|
http.ServeFile(ctx.ResponseWriter, ctx.Request, file)
|
||||||
return
|
return
|
||||||
|
} else {
|
||||||
|
http.NotFound(ctx.ResponseWriter, ctx.Request)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(requestPath, prefix) {
|
if strings.HasPrefix(requestPath, prefix) {
|
||||||
|
Loading…
Reference in New Issue
Block a user