change cookie index separator to underscore

This commit is contained in:
Marcel Juhnke 2019-01-31 20:05:47 +01:00
parent b5b0633e0b
commit a339baf94e

View File

@ -329,7 +329,7 @@ func splitCookie(c *http.Cookie) []*http.Cookie {
count := 0
for len(valueBytes) > 0 {
new := copyCookie(c)
new.Name = fmt.Sprintf("%s-%d", c.Name, count)
new.Name = fmt.Sprintf("%s_%d", c.Name, count)
count++
if len(valueBytes) < maxCookieLength {
new.Value = string(valueBytes)
@ -357,7 +357,7 @@ func joinCookies(cookies []*http.Cookie) (*http.Cookie, error) {
for i := 1; i < len(cookies); i++ {
c.Value += cookies[i].Value
}
c.Name = strings.TrimRight(c.Name, "-0")
c.Name = strings.TrimRight(c.Name, "_0")
return c, nil
}
@ -374,7 +374,7 @@ func loadCookie(req *http.Request, cookieName string) (*http.Cookie, error) {
count := 0
for err == nil {
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 {
cookies = append(cookies, c)
count++