; Collected rules from RFC 6265
; https://tools.ietf.org/html/rfc6265

OWS = *( [ obs-fold ] WSP )

obs-fold = CRLF

set-cookie-header = "Set-Cookie:" SP set-cookie-string

set-cookie-string = cookie-pair *( ";" SP cookie-av )

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

token = %x21 / %x23-27 / %x2A-2B / %x2D-2E / %x30-39 / %x41-5A / %x5E-7A / %x7C

cookie-av = expires-av / max-age-av / domain-av / path-av / secure-av / httponly-av / extension-av

expires-av = "Expires=" sane-cookie-date

sane-cookie-date = rfc1123-date

rfc1123-date = wkday "," SP date1 SP time SP "GMT"

max-age-av = "Max-Age=" non-zero-digit *DIGIT

non-zero-digit = %x31-39

domain-av = "Domain=" domain-value

label = (ALPHA / DIGIT) *(((ALPHA / DIGIT / "-") (ALPHA / DIGIT)) / (ALPHA / DIGIT))

subdomain = label *("." label)

domain-value = subdomain / IPv4address / IPv6address

path-av = "Path=" path-value

path-value = 1*(%x20-3A / %x3C-7E)

secure-av = "Secure"

httponly-av = "HttpOnly"

extension-av = 1*( %x20-3A / %x3C-7E)

cookie-date = *delimiter date-token-list *delimiter

date-token-list = date-token *( 1*delimiter date-token )

date-token = 1*non-delimiter

delimiter = %x09 / %x20-2F / %x3B-40 / %x5B-60 / %x7B-7E

non-delimiter = %x00-08 / %x0A-1F / DIGIT / ":" / ALPHA / %x7F-FF

non-digit = %x00-2F / %x3A-FF

day-of-month = 1*2DIGIT ( non-digit *OCTET )

month = ( "jan" / "feb" / "mar" / "apr" / "may" / "jun" / "jul" / "aug" / "sep" / "oct" / "nov" / "dec" ) *OCTET

year = 2*4DIGIT ( non-digit *OCTET )

time = hms-time ( non-digit *OCTET )

hms-time = time-field ":" time-field ":" time-field

time-field = 1*2DIGIT

cookie-header = "Cookie:" OWS cookie-string OWS

cookie-string = cookie-pair *( ";" SP cookie-pair )
