Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which one is the message and which one the entity in HTTP terminology?

Tags:

http

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.

like image 315
amn Avatar asked Feb 16 '10 15:02

amn


People also ask

What is an entity in HTTP?

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.

What are the two types of HTTP 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.

What is an entity in post request?

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).

What are the 3 parts to a response message?

An HTTP response contains: A status line. A series of HTTP headers, or header fields. A message body, which is usually needed.


1 Answers

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-header⁠s 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.

like image 86
Gumbo Avatar answered Oct 13 '22 00:10

Gumbo