@@ -4,6 +4,7 @@ import (
44 "crypto"
55 "encoding/base64"
66 "fmt"
7+ "net/http"
78 "net/url"
89 "os"
910 "regexp"
@@ -200,6 +201,7 @@ func (o *Options) Validate() error {
200201 }
201202
202203 msgs = parseSignatureKey(o, msgs)
204+ msgs = validateCookieName(o, msgs)
203205
204206 if len(msgs) != 0 {
205207 return fmt.Errorf("Invalid configuration:\n %s",
@@ -261,6 +263,14 @@ func parseSignatureKey(o *Options, msgs []string) []string {
261263 return msgs
262264}
263265
266+func validateCookieName(o *Options, msgs []string) []string {
267+ cookie := &http.Cookie{Name: o.CookieName}
268+ if cookie.String() == "" {
269+ return append(msgs, fmt.Sprintf("invalid cookie name: %q", o.CookieName))
270+ }
271+ return msgs
272+}
273+
264274func addPadding(secret string) string {
265275 padding := len(secret) % 4
266276 switch padding {