RFC2109のCookie仕様

RFC2109のCookie仕様

BNF

RFC 2109 を元に、 FWS を補うなど修正した
 http-response  /= Set-Cookie
 http-request   /= Cookie
 Set-Cookie      = "Set-Cookie:" [FWS] cookies [FWS]
 Cookie          = "Cookie:" [FWS] cookie-version
                   1*([FWS] cookie-separator [FWS] cookie-value) [FWS]
 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
 cookie-value    = NAME [FWS] "=" [FWS] VALUE FWS] ";" [FWS] path]
                   FWS] ";" [FWS] domain]
 NAME            = attr  ;; 「$」で始まる名前は予約
 VALUE           = value
 comment-av      = "Comment" [FWS] "=" [FWS] 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
 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
 version         = "1"   ;; 1*DIGIT
 version-value   = version / <"> version <">

See also

メモ

[1] M-Fr Net Miscellany Cookie ( 版) <http://www.m-fr.net/etc/cookie.html>

[2] >>1 ま、この文書の主張はそんな的外れではないんだけど、こと Cookie に関しては非互換仕様を後から出してきた IETF が悪いでしょうな。 しかも色々不運が重なっちゃってすぐ実装されなかったのは仕方ないとしても、 Cookie2 なんて更に非互換な不良債権まで作っちゃったからな。。。