HTTP Entity

The Entity is transferred by the HTTP request and response message if not otherwise restricted by the request method or response status code. An entity is used to consist of entity-header fields and entity-body, although some responses will only include the entity-headers.

In this section, both the sender and recipient refer to either the client or the server, which depends on who receives the entity.

Entity Header Fields

Entity-header fields are used to define the metainformation about the entity-body. If body isnot present, the entity-header field defines metainformation about the resource identified by request. Some of this metainformation is OPTIONAL. Some might be REQUIRED by the portion of this specification.

Syntax

The extension-header mechanism is used to allow the additional entity-header fields, which is defined without the protocol change, but these fields cannot be assumed to be recognizable by the recipient. Recipient ignores the unrecognized header fields and MUST be forwarded by transparent proxies.

Entity Body

If there is any entity-body, it will send with an HTTP request or an HTTP response in the format as described below. The entity-header fields define the encoding.

Syntax

When a message-body is present, an entity-body will only present in a message. The entity-body is obtained from the message-body using decoding any Transfer-Encoding that might have been applied to ensure the proper and safe transfer of the message.

Type

When an entity-body is included with a message, the header fields Content-Type and Content-Encoding determines the data type of that body. These are used to define a two-layer, ordered encoding model:

Syntax

Content-Type is used to specify the media type of the underlying data. Content-Encoding indicates any additional content coding which is applied to the data, usually for the purpose of data compression that is a requested resource property.

Any message of HTTP/1.1 containing an entity-body SHOULD include a Content-Type header field that defines the media type of that body.If and only if a Content-Type field is not given the media type, the recipient MAY attempt to guess the media type using the inspection of its content or the name extension of the URI, which is used to identify the resource. The recipient SHOULD treat it as "application/octet-stream" type if the media type remains unknown.

Entity Length

The message of an entity length is the length of the message body before applying any transfer-coding.


Next TopicURL Methods




Latest Courses