24cf06d2 by fuxiaohei

code style simplify for context package

1 parent f988f035
...@@ -155,8 +155,11 @@ func (ctx *Context) CheckXsrfCookie() bool { ...@@ -155,8 +155,11 @@ func (ctx *Context) CheckXsrfCookie() bool {
155 } 155 }
156 if token == "" { 156 if token == "" {
157 ctx.Abort(403, "'_xsrf' argument missing from POST") 157 ctx.Abort(403, "'_xsrf' argument missing from POST")
158 } else if ctx._xsrf_token != token { 158 return false
159 }
160 if ctx._xsrf_token != token {
159 ctx.Abort(403, "XSRF cookie does not match POST argument") 161 ctx.Abort(403, "XSRF cookie does not match POST argument")
162 return false
160 } 163 }
161 return true 164 return true
162 } 165 }
......
...@@ -72,11 +72,11 @@ func (input *BeegoInput) Site() string { ...@@ -72,11 +72,11 @@ func (input *BeegoInput) Site() string {
72 func (input *BeegoInput) Scheme() string { 72 func (input *BeegoInput) Scheme() string {
73 if input.Request.URL.Scheme != "" { 73 if input.Request.URL.Scheme != "" {
74 return input.Request.URL.Scheme 74 return input.Request.URL.Scheme
75 } else if input.Request.TLS == nil { 75 }
76 if input.Request.TLS == nil {
76 return "http" 77 return "http"
77 } else {
78 return "https"
79 } 78 }
79 return "https"
80 } 80 }
81 81
82 // Domain returns host name. 82 // Domain returns host name.
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!