HTTP Entity: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(19 intermediate revisions by the same user not shown)
Line 6: Line 6:


* [[HTTP#Subjects|HTTP]]
* [[HTTP#Subjects|HTTP]]
* [[HTTP_Request#The_HTTP_Request_Body|HTTP Request]]
* [[HTTP_Response#The_HTTP_Response_Body|HTTP Response]]


=Overview=
=Overview=


The HTTP request/response may optionally transfer an ''entity''. An entity consists of entity header fields, which are grouped together with the other headers of the request or response, and an entity-body.
The HTTP request/response may optionally transfer an '''entity'''. An entity consists of [[Entity_HTTP_Header_Fields|entity header fields]], which are grouped together with the other headers of the request or response, and an [[#Entity_Body|entity-body]]. The HTTP protocol requires that requests/response which include a body either use chunked transfer encoding or send a [[HTTP_Entity_Header_Content-Length|Content-Length]] request header.
 
The HTTP protocol requires that requests/response which include a body either use chunked transfer encoding or send a Content-Length request header.


=Entity Headers=
=Entity Headers=
Line 19: Line 19:
=Entity Body=
=Entity Body=


{{External|https://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html#sec7.2}}
{{External2|Message Body: https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.3|Entity Body: https://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html#sec7.2}}


The entity body (if any) sent with the HTTP request/response is in a format and encoding defined by the [[Entity HTTP Header Fields|Entity Headers]].
The '''entity body''' (if any) sent with the HTTP request/response is in a format and encoding defined by the [[Entity HTTP Header Fields|entity headers]]. The entity body is obtained from the '''message body''' by applying the inverse of the transfer encoding, as specified by [[HTTP General Header Transfer-Encoding|Transfer-Encoding]], if any.


==Entity Body Type==
==Entity Body Type==


When an entity body is included with a message, the data type of that body is determined via the header fields Content-Type and Content- Encoding. These define a two-layer, ordered encoding model:
When an entity body is included with a message, the data type of that body is determined from the entity header fields [[HTTP Entity Header Content-Type|Content-Type]] and [[HTTP Entity Header Content-Encoding|Content-Encoding]]. These define a two-layer, ordered encoding model:


<pre>
<pre>
entity-body = Content-Encoding(Content-Type(data) )
entity-body = Content-Encoding(Content-Type(data))
</pre>
</pre>
Content-Type specifies the media type of the underlying data. Content-Encoding may be used to indicate any additional content codings applied to the data, usually for the purpose of data compression, that are a property of the requested resource. There is no default encoding.
Any HTTP/1.1 message containing an entity-body SHOULD include a Content-Type header field defining the media type of that body. If and only if the media type is not given by a Content-Type field, the recipient MAY attempt to guess the media type via inspection of its content and/or the name extension(s) of the URI used to identify the resource. If the media type remains unknown, the recipient SHOULD treat it as type "application/octet-stream".


==Entity Body Length==
==Entity Body Length==


 
<font color=red>The length of a entity is the length of the message body before any transfer encodings have been applied.</font>
7.2.2 Entity Length
 
The entity-length of a message is the length of the message-body before any transfer-codings have been applied. Section 4.4 defines how the transfer-length of a message-body is determined.

Latest revision as of 19:45, 26 September 2018

External

Internal

Overview

The HTTP request/response may optionally transfer an entity. An entity consists of entity header fields, which are grouped together with the other headers of the request or response, and an entity-body. The HTTP protocol requires that requests/response which include a body either use chunked transfer encoding or send a Content-Length request header.

Entity Headers

Entity Headers

Entity Body

Message Body: https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.3
Entity Body: https://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html#sec7.2

The entity body (if any) sent with the HTTP request/response is in a format and encoding defined by the entity headers. The entity body is obtained from the message body by applying the inverse of the transfer encoding, as specified by Transfer-Encoding, if any.

Entity Body Type

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

entity-body = Content-Encoding(Content-Type(data))

Entity Body Length

The length of a entity is the length of the message body before any transfer encodings have been applied.