9d0798ed by fuxiaohei

Merge branch 'develop' of https://github.com/astaxie/beego into develop

2 parents e52386b5 1858f307
...@@ -75,12 +75,6 @@ func (cs *CouchbaseSessionStore) SessionID() string { ...@@ -75,12 +75,6 @@ func (cs *CouchbaseSessionStore) SessionID() string {
75 func (cs *CouchbaseSessionStore) SessionRelease(w http.ResponseWriter) { 75 func (cs *CouchbaseSessionStore) SessionRelease(w http.ResponseWriter) {
76 defer cs.b.Close() 76 defer cs.b.Close()
77 77
78 // if rs.values is empty, return directly
79 if len(cs.values) < 1 {
80 cs.b.Delete(cs.sid)
81 return
82 }
83
84 bo, err := session.EncodeGob(cs.values) 78 bo, err := session.EncodeGob(cs.values)
85 if err != nil { 79 if err != nil {
86 return 80 return
......
...@@ -72,11 +72,6 @@ func (rs *MemcacheSessionStore) SessionID() string { ...@@ -72,11 +72,6 @@ func (rs *MemcacheSessionStore) SessionID() string {
72 // save session values to redis 72 // save session values to redis
73 func (rs *MemcacheSessionStore) SessionRelease(w http.ResponseWriter) { 73 func (rs *MemcacheSessionStore) SessionRelease(w http.ResponseWriter) {
74 defer rs.c.Close() 74 defer rs.c.Close()
75 // if rs.values is empty, return directly
76 if len(rs.values) < 1 {
77 rs.c.Delete(rs.sid)
78 return
79 }
80 75
81 b, err := session.EncodeGob(rs.values) 76 b, err := session.EncodeGob(rs.values)
82 if err != nil { 77 if err != nil {
......
...@@ -81,12 +81,6 @@ func (rs *RedisSessionStore) SessionRelease(w http.ResponseWriter) { ...@@ -81,12 +81,6 @@ func (rs *RedisSessionStore) SessionRelease(w http.ResponseWriter) {
81 c := rs.p.Get() 81 c := rs.p.Get()
82 defer c.Close() 82 defer c.Close()
83 83
84 // if rs.values is empty, return directly
85 if len(rs.values) < 1 {
86 c.Do("DEL", rs.sid)
87 return
88 }
89
90 b, err := session.EncodeGob(rs.values) 84 b, err := session.EncodeGob(rs.values)
91 if err != nil { 85 if err != nil {
92 return 86 return
......
...@@ -27,11 +27,14 @@ func serverStaticRouter(ctx *context.Context) { ...@@ -27,11 +27,14 @@ func serverStaticRouter(ctx *context.Context) {
27 if len(prefix) == 0 { 27 if len(prefix) == 0 {
28 continue 28 continue
29 } 29 }
30 if requestPath == "/favicon.ico" { 30 if requestPath == "/favicon.ico" || requestPath == "/robots.txt" {
31 file := path.Join(staticDir, requestPath) 31 file := path.Join(staticDir, requestPath)
32 if utils.FileExists(file) { 32 if utils.FileExists(file) {
33 http.ServeFile(ctx.ResponseWriter, ctx.Request, file) 33 http.ServeFile(ctx.ResponseWriter, ctx.Request, file)
34 return 34 return
35 } else {
36 http.NotFound(ctx.ResponseWriter, ctx.Request)
37 return
35 } 38 }
36 } 39 }
37 if strings.HasPrefix(requestPath, prefix) { 40 if strings.HasPrefix(requestPath, prefix) {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!