Browse Source

update cookie (#44)

保证默认cookie切换到安全cookie时值的正常性。
tags/v0.5.5
@七月 Lunny Xiao <xiaolunwen@gmail.com> 2 years ago
parent
commit
3f7f391de2
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      cookie.go

+ 3
- 0
cookie.go View File

@@ -463,6 +463,9 @@ type secureCookies struct {
var _ Cookies = &secureCookies{}

func parseSecureCookie(secret string, value string) string {
if strings.Count(value, "|") < 2 {
return ""
}
parts := strings.SplitN(value, "|", 3)
val, timestamp, sig := parts[0], parts[1], parts[2]
if getCookieSig(secret, []byte(val), timestamp) != sig {


Loading…
Cancel
Save