Skip to content

Commit 8f95fe9

Browse files
committed
Address review feedback
This commit addresses review feedback and improves the correctness of the grammar for various edge cases (Ex: `Domain=;` and `Path;`). It also fixes some issues with how '/' was used in the previous commit.
1 parent 60efc12 commit 8f95fe9

File tree

1 file changed

+34
-24
lines changed

1 file changed

+34
-24
lines changed

draft-ietf-httpbis-rfc6265bis.md

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@ and WSP (whitespace).
312312
The OWS (optional whitespace) and BWS (bad whitespace) rules are defined in
313313
Section 5.6.3 of {{!HTTPSEM=I-D.ietf-httpbis-semantics}}.
314314

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+
315318
## Terminology
316319

317320
The terms "user agent", "client", "server", "proxy", and "origin server" have
@@ -478,11 +481,12 @@ Cookie and Set-Cookie header fields.
478481
The Set-Cookie HTTP response header field is used to send cookies from the server to
479482
the user agent.
480483

481-
### Syntax {#sane-abnf-syntax}
484+
### Syntax {#server-abnf-syntax}
482485

483486
Informally, the Set-Cookie response header field contains a cookie, which begins with a
484487
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.
486490

487491
Note that the grammar used by the user agent when processing Set-Cookie header fields
488492
is more permissive than this grammar. (See {{ua-abnf-syntax}} for more details.)
@@ -1400,15 +1404,15 @@ with
14001404
## Syntax {#ua-abnf-syntax}
14011405

14021406
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:
14051409

14061410
~~~ abnf
14071411
set-cookie = set-cookie-string
14081412
set-cookie-string = cookie-pair *( BWS ";" OWS cookie-av)
14091413
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
14121416

14131417
cookie-name = *4096(cookie-name-octet)
14141418
cookie-value = *4096(cookie-value-octet)
@@ -1425,32 +1429,38 @@ cookie-av = expires-av / max-age-av / domain-av /
14251429
; attributes that don't conform to the grammars
14261430
; below are ignored
14271431

1432+
ignored-eq-value = "" / ("=" BWS ignored-value)
1433+
ignored-value = optional-value
1434+
optional-value = *1024(cookie-value-octet)
1435+
14281436
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
14301438
; in a previous section
14311439

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))
14391443

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
14421449

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
14441453

1445-
httponly-av = "HttpOnly" BWS *ignored-value
1454+
secure-av = "Secure" BWS ignored-eq-value BWS
14461455

1447-
samesite-av = "SameSite" BWS "=" BWS samesite-value BWS
1448-
samesite-value = "Strict" / "Lax" / "None"
1456+
httponly-av = "HttpOnly" BWS ignored-eq-value BWS
14491457

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
14511461

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)
14541464
~~~
14551465

14561466
## Storage Model {#storage-model}
@@ -2314,7 +2324,7 @@ reference detailing how the attribute is to be processed and stored.
23142324

23152325
New registrations happen on a "RFC Required" basis (see Section 4.7 of
23162326
{{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
23182328
defined in CamelCase, but technically accepted case-insensitively.
23192329

23202330
### Registration

0 commit comments

Comments
 (0)