Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comprehensive list of HTTP Status Codes THAT DON'T INCLUDE A RESPONSE BODY

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.

like image 678
unixman83 Avatar asked Dec 25 '11 07:12

unixman83


1 Answers

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.

like image 181
Mat Avatar answered Nov 09 '22 02:11

Mat