RFC2965のCookie仕様

RFC2965のCookie仕様

BNF

RFC 2965 を元に、 FWS を補うなど修正した
 http-response  /= Set-Cookie
 http-request   /= Cookie / Cookie2
 Set-Cookie      = "Set-Cookie2:" [FWS] cookies [FWS]
 Cookie          = "Cookie:" [FWS] cookie-version
                   1*([FWS] cookie-separator [FWS] cookie-value) [FWS]
 Cookie2         = "Cookie2:" cookie-version
 cookie-separator = ";"  ;; 過去との互換性のためこちらを使用する
                  / ","  ;; 将来との互換性のためサーバーは認識すべし
 cookies         = a-cookie *([FWS] "," [FWS] a-cookie)
 a-cookie        = NAME [FWS] "=" [FWS] VALUE *([FWS] ";" [FWS] cookie-av)
 cookie-av       = comment-av / domain-av / max-age-av / path-av
                 / secure-av / version-av / commenturl-av / discard-av
                 / port-av
 cookie-value    = NAME [FWS] "=" [FWS] VALUE FWS] ";" [FWS] path]
                   FWS] ";" [FWS] domain
 NAME            = attr  ;; 「$」で始まる名前は予約
 VALUE           = value
 comment-av      = "Comment" [FWS] "=" [FWS] utf-8-value
 domain-av       = "Domain" [FWS] "=" [FWS] domain-value
 max-age-av      = "Max-Age" [FWS] "=" [FWS] delta-value
 path-av         = "Path" [FWS] "=" [FWS] path-value
 secure-av       = "Secure"
 version-av      = "Version" [FWS] "=" [FWS] version
 path            = "$Path" [FWS] "=" [FWS] path-value
 domain          = "$Domain" [FWS] "=" [FWS] domain-value
 cookie-version  = "$Version" [FWS] "=" [FWS] version-value
 commenturl-av   = "CommentURL" [FWS] "=" [FWS] <"> http_URL <">
 discard-av      = "Discard"
 port-av         = "Port" [ [FWS] "=" [FWS] <"> portlist <"> ]
 port            = "$Port" [ [FWS] "=" [FWS] <"> portlist <"> ]
 attr            = http-token
 value           = http-token / quoted-string
 domain-value    = ["."] dot-http-token / <"> ["."] dot-atom <">
 path-value      = abs_path / <"> abs_path <">
 delta-value     = delta-seconds / <"> delta-seconds <">
 delta-seconds   = 1*DIGIT
 this-version    = "1"   ;; 1*DIGIT
 version         = 1*DIGIT
 version-value   = version / <"> version <">
 portlist        = portnum *([FWS] "," [FWS] portnum)
 portnum         = 1*DIGIT
 utf-8           = <a UTF-8 [RFC 2279] character>
 utf-8-value     = *token / <"> *utf-8 <">

See also