change cookie index separator to underscore
This commit is contained in:
parent
b5b0633e0b
commit
a339baf94e
@ -329,7 +329,7 @@ func splitCookie(c *http.Cookie) []*http.Cookie {
|
|||||||
count := 0
|
count := 0
|
||||||
for len(valueBytes) > 0 {
|
for len(valueBytes) > 0 {
|
||||||
new := copyCookie(c)
|
new := copyCookie(c)
|
||||||
new.Name = fmt.Sprintf("%s-%d", c.Name, count)
|
new.Name = fmt.Sprintf("%s_%d", c.Name, count)
|
||||||
count++
|
count++
|
||||||
if len(valueBytes) < maxCookieLength {
|
if len(valueBytes) < maxCookieLength {
|
||||||
new.Value = string(valueBytes)
|
new.Value = string(valueBytes)
|
||||||
@ -357,7 +357,7 @@ func joinCookies(cookies []*http.Cookie) (*http.Cookie, error) {
|
|||||||
for i := 1; i < len(cookies); i++ {
|
for i := 1; i < len(cookies); i++ {
|
||||||
c.Value += cookies[i].Value
|
c.Value += cookies[i].Value
|
||||||
}
|
}
|
||||||
c.Name = strings.TrimRight(c.Name, "-0")
|
c.Name = strings.TrimRight(c.Name, "_0")
|
||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,7 +374,7 @@ func loadCookie(req *http.Request, cookieName string) (*http.Cookie, error) {
|
|||||||
count := 0
|
count := 0
|
||||||
for err == nil {
|
for err == nil {
|
||||||
var c *http.Cookie
|
var c *http.Cookie
|
||||||
c, err = req.Cookie(fmt.Sprintf("%s-%d", cookieName, count))
|
c, err = req.Cookie(fmt.Sprintf("%s_%d", cookieName, count))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
cookies = append(cookies, c)
|
cookies = append(cookies, c)
|
||||||
count++
|
count++
|
||||||
|
Loading…
Reference in New Issue
Block a user