I was beginning to like HTTP, until I discovered that some status codes like 304
, contain no message body and are terminated by CRLF.
Where's a comprehensive list? So far I got: 100-199
, 204
, and 304
. Are there any others?
EDIT: No, there are no others, according to the standard. Thanks for the answer.
I am concerned with message delimiting with persistent connections. i.e. where does one HTTP message stop and the next begin.
A body is optional for all the 4xx
error codes:
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.
Same for the 5xx
:
Except when responding to a HEAD request, the server SHOULD include an entity containing an explanation of the error situation...
(SHOULD means that really, they should, but it's not a MUST.)
The 1xx
messages don't contain a body as far as I can tell. 201
(in addition to 204
and 205
) doesn't have to have a body. The 3xx
are a mixed bag, but a body is optional for a lot of them.
Source: HTTP/1.1: Status Code definitions.
The rules for message length information are described in HTTP Message - 4.4 Message Length. It's not exactly trivial.
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