I am trying to make better sense of HTTP internals, and often "entities" and "messages" are mentioned in the specification, strangely enough without proper explanation though, believe it or not. From what I gathered, one identifies the content itself, even when split across a request / response chain and/or transfer encoding fragmentation rules, while the other identifies content of a single HTTP request - i.e. what follows the headers and ends with a CRLF. My problem is I cannot figure out which one is which exactly.
An entity header is an HTTP header that describes the payload of an HTTP message (i.e. metadata about the message body). Entity headers include: Content-Length , Content-Language , Content-Encoding , Content-Type , Expires , etc. Entity headers may be present in both HTTP request and response messages.
HTTP messages are how data is exchanged between a server and a client. There are two types of messages: requests sent by the client to trigger an action on the server, and responses, the answer from the server.
Show activity on this post. An HTTP entity is the majority of an HTTP request or response, consisting of some of the headers and the body, if present. It seems to be the entire request or response without the request or status line (although only certain header fields are considered part of the entity).
An HTTP response contains: A status line. A series of HTTP headers, or header fields. A message body, which is usually needed.
A HTTP-message is either a request or a response:
HTTP-message = Request | Response ; HTTP/1.1 messages
A HTTP-message has zero or more message-headers and may have a message-body:
generic-message = start-line *(message-header CRLF) CRLF [ message-body ]
So not every HTTP-message has a message-body. But if it has a message-body, then that’s also the entity-body:
message-body = entity-body | <entity-body encoded as per Transfer-Encoding>
So in short: A message is the whole HTTP request or response. And the entity is the message’s body (if there is any) and its corresponding entity header fields.
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