@@ -312,6 +312,9 @@ and WSP (whitespace).
312
312
The OWS (optional whitespace) and BWS (bad whitespace) rules are defined in
313
313
Section 5.6.3 of {{!HTTPSEM=I-D.ietf-httpbis-semantics}}.
314
314
315
+ Note that per {{RFC5234}}, all strings literals used in the grammars are
316
+ case-insensitive (e.g. "Secure" is equiavelent to "secure" and "sEcUrE").
317
+
315
318
# # Terminology
316
319
317
320
The terms "user agent", "client", "server", "proxy", and "origin server" have
@@ -478,11 +481,12 @@ Cookie and Set-Cookie header fields.
478
481
The Set-Cookie HTTP response header field is used to send cookies from the server to
479
482
the user agent.
480
483
481
- # ## Syntax {#sane -abnf-syntax}
484
+ # ## Syntax {#server -abnf-syntax}
482
485
483
486
Informally, the Set-Cookie response header field contains a cookie, which begins with a
484
487
name-value-pair, followed by zero or more attribute-value pairs. Servers
485
- SHOULD NOT send Set-Cookie header fields that fail to conform to the grammar below.
488
+ SHOULD NOT send Set-Cookie header fields that fail to conform to the grammar
489
+ immediately below.
486
490
487
491
Note that the grammar used by the user agent when processing Set-Cookie header fields
488
492
is more permissive than this grammar. (See {{ua-abnf-syntax}} for more details.)
@@ -1400,15 +1404,15 @@ with
1400
1404
# # Syntax {#ua-abnf-syntax}
1401
1405
1402
1406
Based on the parsing algorithms defined above, the following grammar defines
1403
- the syntax requirements enforced by user agents when parsing specific
1404
- subcomponents of the Cookie and Set-Cookie header fields :
1407
+ the syntax requirements enforced by user agents when parsing
1408
+ set-cookie-strings :
1405
1409
1406
1410
~~~ abnf
1407
1411
set-cookie = set-cookie-string
1408
1412
set-cookie-string = cookie-pair *( BWS ";" OWS cookie-av)
1409
1413
cookie-pair = *1(BWS cookie-name BWS "=") BWS cookie-value BWS
1410
- ; cookie-name plus cookie-value must be less than
1411
- ; or equal to 4096 octets
1414
+ ; the sum of the lengths of cookie-name and cookie-value
1415
+ ; must be less than or equal to 4096 octets
1412
1416
1413
1417
cookie-name = *4096(cookie-name-octet)
1414
1418
cookie-value = *4096(cookie-value-octet)
@@ -1425,32 +1429,38 @@ cookie-av = expires-av / max-age-av / domain-av /
1425
1429
; attributes that don't conform to the grammars
1426
1430
; below are ignored
1427
1431
1432
+ ignored-eq-value = "" / ("=" BWS ignored-value)
1433
+ ignored-value = optional-value
1434
+ optional-value = *1024(cookie-value-octet)
1435
+
1428
1436
expires-av = "Expires" BWS "=" BWS cookie-date BWS
1429
- ; cookie-date is defined in separate grammar
1437
+ ; cookie-date is defined in a separate grammar
1430
1438
; in a previous section
1431
1439
1432
- max-age-av = "Max-Age" BWS "=" BWS max-age-value BWS
1433
- max-age-value = 1*1024(DIGIT) / "-" 1*1023(DIGIT)
1434
-
1435
- domain-av = "Domain" BWS "=" BWS domain-value BWS
1436
- domain-value = 1*1024(cookie-value-octet)
1437
- ; a leading dot in domain-value will be removed
1438
- ; if present
1440
+ max-age-av = "Max-Age" BWS max-age-eq-value BWS
1441
+ max-age-eq-value = "" / ("=" BWS max-age-value)
1442
+ max-age-value = *1024(DIGIT) / ("-" *1023(DIGIT))
1439
1443
1440
- path-av = "Path" BWS "=" BWS path-value BWS
1441
- path-value = 1*1024(cookie-value-octet)
1444
+ domain-av = "Domain" BWS domain-eq-value BWS
1445
+ domain-eq-value = "" / ("=" BWS domain-value)
1446
+ domain-value = optional-value
1447
+ ; a leading %x2E (period) in domain-value will be
1448
+ ; removed if present
1442
1449
1443
- secure-av = "Secure" BWS *ignored-value
1450
+ path-av = "Path" BWS path-eq-value BWS
1451
+ path-eq-value = "" / ("=" BWS path-value)
1452
+ path-value = optional-value
1444
1453
1445
- httponly -av = "HttpOnly " BWS * ignored-value
1454
+ secure -av = "Secure " BWS ignored-eq- value BWS
1446
1455
1447
- samesite-av = "SameSite" BWS "=" BWS samesite-value BWS
1448
- samesite-value = "Strict" / "Lax" / "None"
1456
+ httponly-av = "HttpOnly" BWS ignored-eq-value BWS
1449
1457
1450
- extension-av = 1*cookie-name-octet BWS *optional-value
1458
+ samesite-av = "SameSite" BWS samesite-eq-value BWS
1459
+ samesite-eq-value = "" / ("=" BWS samesite-value)
1460
+ samesite-value = "Strict" / "Lax" / "None" / ignored-value
1451
1461
1452
- ignored-value = "=" BWS *1024( cookie-value -octet) BWS
1453
- optional- value = ignored -value
1462
+ extension-av = 1* cookie-name -octet BWS extension-eq-value BWS
1463
+ extension-eq- value = "" / ("=" BWS optional -value)
1454
1464
~~~
1455
1465
1456
1466
# # Storage Model {#storage-model}
@@ -2314,7 +2324,7 @@ reference detailing how the attribute is to be processed and stored.
2314
2324
2315
2325
New registrations happen on a "RFC Required" basis (see Section 4.7 of
2316
2326
{{RFC8126}}). The attribute to be registered MUST match the `extension-av`
2317
- syntax defined in {{sane -abnf-syntax}}. Note that attribute names are generally
2327
+ syntax defined in {{server -abnf-syntax}}. Note that attribute names are generally
2318
2328
defined in CamelCase, but technically accepted case-insensitively.
2319
2329
2320
2330
# ## Registration
0 commit comments