Skip to content

Commit 2f553a7

Browse files
ylafonLeaVeroucynthiaplinss
authored
HTTP header syntax definition principle (#287)
* add text suggesting the use of structured headers in HTTP header definitions * typo fixed Co-authored-by: Lea Verou <[email protected]> * Update index.bs Co-authored-by: Peter Linss <[email protected]> * Update index.bs Co-authored-by: Lea Verou <[email protected]> Co-authored-by: Sangwhan "fish" Moon <[email protected]> Co-authored-by: Peter Linss <[email protected]>
1 parent 4044c94 commit 2f553a7

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

index.bs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,6 +2019,27 @@ due to security implications, and instead recommend enforcing strict MIME types
20192019

20202020
New MIME types should have a specification and should be registered with the Internet Assigned Numbers Authority (IANA).
20212021

2022+
<h3 id="new-http-header-syntax">New HTTP Headers</h3>
2023+
2024+
If you are defining a new HTTP header,
2025+
its syntax mustn't go against
2026+
[the HTTP specification](https://tools.ietf.org/html/rfc7230#section-3.2).
2027+
2028+
If the new header must convey structured data,
2029+
such as lists, dictionaries, or typed values
2030+
like decimals, strings, or booleans,
2031+
then the header should use the syntax
2032+
defined in [Structured Field Values for HTTP](https://tools.ietf.org/html/rfc8941).
2033+
This avoids consumers of the header
2034+
having to write and maintain specific micro-parsers,
2035+
or even worse,
2036+
something that would break those existing parsers.
2037+
If the new header requires data
2038+
that can't be represented by Structured Field Values,
2039+
then either engage with IETF about
2040+
extending the Structured Field Values syntax,
2041+
or re-consider if an HTTP header is a right place
2042+
to expose the data before inventing a new syntax. [[RFC8941]]
20222043

20232044
<h3 id="extend-manifests">Extend existing manifest files rather than creating new ones</h3>
20242045

0 commit comments

Comments
 (0)