开始喜欢HTTP,直到发现一些状态码like 304
, 不包含消息体并由 CRLF 终止。
哪里有完整的 list ?到目前为止,我得到了:100-199
, 204
, 和 304
.还有其他人吗?
编辑 : 不,根据标准,没有其他人。谢谢你的回答。
我关心用持久连接分隔消息。即一个 HTTP 消息在哪里停止,下一个开始。
最佳答案
所有 4xx
的主体都是可选的错误代码:
Except when responding to a HEAD request, the server SHOULD include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition.
与
5xx
相同:Except when responding to a HEAD request, the server SHOULD include an entity containing an explanation of the error situation...
(应该意味着真的,他们应该,但这不是必须的。)
1xx
据我所知,消息不包含正文。 201
(除了 204
和 205
)不必有 body 。 3xx
是一个混合包,但对很多人来说, body 是可选的。来源:HTTP/1.1: Status Code definitions .
消息长度信息的规则在 HTTP Message - 4.4 Message Length 中描述.这不是微不足道的。
关于http-status-codes - 不包含响应体的 HTTP 状态代码的完整列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8628725/