Are values such as keep-alive
, Close
, and Upgrade
of the Connection:
header case sensitive?
I'm writing a simple web server and wondering whether I should be transforming the values to lower case before checking them.
I can’t find any explicit specification of the case-sensitivity of the Connection’s field values. But as Connection may contain the name of header fields:
[…] for each connection-token in this field, remove any header field(s) from the message with the same name as the connection-token.
and as those header field names are case-insensitive, I conclude that the Connection’s field value is also considered case-insensitive.
No, the Connection header values (a.k.a. "connection options") are case-insensitive. The updated HTTP 1.1 RFC 7230, in section 6.1 states:
The Connection header field's value has the following grammar:
Connection = 1#connection-option connection-option = token
Connection options are case-insensitive.
My bold. Note that all header fields are case-insensitive.
Each header field consists of a case-insensitive field name...
Of course, keep in mind that this is just what the specification says. It doesn't mean that all browser, server, etc. implementations are compliant (or bug-free ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With