cookie字符串中的有效字符?

时间:2015-03-06 02:08:51

标签: http cookies

这个cookie字符串有效吗?特别是这个位I0=; []scayt_verLang=6;我找不到规范或在线验证器的简单细分。

Cookie  JavascriptEnabled=true; Cms_User_Id=removed6CYjfBVknUjmvf9Pp/uSVYoemoQOXCcB0SOg3kZWX9/KZfo9v5C8O7MmLg1Xz0qXf94Wf86p4rLi2lxxminXfnP/16p6pzmwIU5qz7Of4plcQkK6JM6XiU/zbyZb3gksDOz2s8xjhfzWg0ekjgTZUx76/kFuW10/Rf7O8n05aIZzhUX0Gd9UNjk40zLA1DkJ02uNGtMbnil9P9iqVARhE0CNjCZFxc9qoLpyyRXtqG8nv0V/3k175KXzzg6iW6j9jH/DuGH8ko5YZoo6TxiIcW3ViRnFVfoiMK49iatauD2nF6xOtRV6LLH57RV3DhkhTTb/MQurw8bHYbsZWJRIuSnFwKeFUEOoxvRG4friI6d4Qug11F1oM3ECSdbDeKKPXuq5+IUImt8XXZUtBFUeakqWT4oXgnsToeNoI0=; []scayt_verLang=6; ASP.NET_SessionId=removed0l4mhioft0uavblzdeq; last_msg_check=1425606361000

谢谢,

1 个答案:

答案 0 :(得分:1)

Cookie和Set-Cookie HTTP标头在RFC 6265 Section 4中定义,RFC 2616 Section 2.2提供基本类型。

cookie-header = "Cookie:" OWS cookie-string OWS
cookie-string = cookie-pair *( ";" SP cookie-pair )
cookie-pair       = cookie-name "=" cookie-value
cookie-name       = token
cookie-value      = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
cookie-octet      = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
                    ; US-ASCII characters excluding CTLs,
                    ; whitespace DQUOTE, comma, semicolon,
                    ; and backslash
token             = <token, defined in [RFC2616], Section 2.2>

RFC 2616中定义的令牌......

token          = 1*<any CHAR except CTLs or separators>
CHAR           = <any US-ASCII character (octets 0 - 127)>
CTL            = <any US-ASCII control character
                 (octets 0 - 31) and DEL (127)>
separators     = "(" | ")" | "<" | ">" | "@"
                 | "," | ";" | ":" | "\" | <">
                 | "/" | "[" | "]" | "?" | "="
                 | "{" | "}" | SP | HT

让我们看看你的cookie(我已经删除了大部分垃圾)。

JavascriptEnabled=true; Cms_User_Id=removedlotsoftextI0=; []scayt_verLang=6; ASP.NET_SessionId=removed0l4mhioft0uavblzdeq; last_msg_check=1425606361000

你有一堆cookie对......

  • JavascriptEnabled =真
  • Cms_User_Id = removedlotsoftextI0 =
  • [] scayt_verLang = 6
  • ASP.NET_SessionId = removed0l4mhioft0uavblzdeq
  • last_msg_check = 1425606361000

cookie-name []scayt_verLang无效,因为它包含令牌中不允许使用的分隔符。

I0=不是它自己的对,而是Cms_User_Id的很长值的尾端。 <{1}}允许=,因此它有效。