

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Headers
incomplete
2: Constraints
incomplete
3: Multiple Values
incomplete
4: Add to Parse
incomplete
5: Live Headers
incomplete
This lesson's interactive features are locked, please to keep using them
We've got our header parsing mostly working, but we're actually not being as strict as we should be to match the RFC. Let's fix that.
Ever wonder why there's usually a .Get method on a header object to get header values? It's because these darned keys (not necessarily values) are case insensitive! If you use the hash map directly, you'll have to account for Content-Length and content-length being the same on your own.
Interestingly, definitions can be spread across multiple RFCs.field-name has an implicit definition of a token as defined by RFC 9110.
5.1. Field Names
A field name labels the corresponding field value as having the semantics defined by that name. For example, the Date header field is defined in Section 6.6.1 as containing the origination timestamp for the message in which it appears.
field-name = token
And then in 5.6.2:
token = 1*tchar
tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
/ "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
/ DIGIT / ALPHA
; any VCHAR, except delimiters
In other words, a field-name must contain only:
!, #, $, %, &, ', *, +, -, ., ^, _, `, |, ~and at least a length of 1.
Run and submit the CLI tests.