HTTP 标头(Content-Type 等)是否区分大小写?
也许我浏览得太快,但找不到具体记录。在我的特定情况下,我想知道“Content-Type”标头,但我假设相同的规则适用于其他标准标头。
这些是否区分大小写,如果是:是 Content-Type
还是 Content-type
?
是否有合适的位置来引用这些?
Perhaps I'm skimming too fast, but couldn't find this specifically documented. In my particular case, I'm wondering about the "Content-Type" header, but I'm assuming the same rules would apply to other standard headers.
Are these case sensitive, and if so: Is it Content-Type
or Content-type
?
Is there a proper place to reference these?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不区分大小写。
超文本传输协议 - - HTTP/1.1:
Case-insensitive.
Hypertext Transfer Protocol -- HTTP/1.1:
看起来 Content-type 标头值中的 MIME 类型不区分大小写,因此 application/PDF 和 application/pdf 是等效的。它确实说参数值区分大小写,因此从技术上讲“text/html; charset=UTF-8”并不等同于“text/html; charset=utf-8”。但这不是一个很好的例子,因为 http://www.w3.org/TR/html4 /charset.html#h-5.2.1 表示“字符编码的名称不区分大小写”。
http://www.w3.org/Protocols/rfc1341/4_Content-Type.html
Looks like the MIME type in a Content-type header value is case-insensitive, so application/PDF and application/pdf are equivalent. It does say parameter values are case-sensitive, so technically "text/html; charset=UTF-8" is not equivalent to "text/html; charset=utf-8". But that's not a good example because http://www.w3.org/TR/html4/charset.html#h-5.2.1 says "Names for character encodings are case-insensitive".
http://www.w3.org/Protocols/rfc1341/4_Content-Type.html