ch15: Entities and Encodings
1. Messages Are Crates, Entities Are Cargo
Headers about entities:
Header | Description |
Content-Type | The kind of object carried by the entity. |
Content-Length | The length or size of the message being sent. |
Content-Language | The human language that best matches the obejct being sent. |
Content-Location | An alternate location for the object at the time of the request. |
Content-Range | If this is a partial entity, this header defines which pieces of the whole are included. |
Content-MD5 | A checksum of the contents of the entity body. |
Last-Modified | The date on which this particular content was created or modified at the server. |
Expires | The date and time at which this entity data will become stale. |
Allow | What request methods are legal on this resource. |
ETag | A unique validator for this particular instance of the document. The ETag header is not defined formally as an entity header, but it is an important header for many operations involving entities. |
Cache-Control | Directives on how this document can be cached. The Cache-Control header, like the ETag header, is not defined formally as an entity header. |
2. Content-Length: The Entity's Size
Content-Lenght is needed to detect premature message truncation when servers crash and to properly segment messages that share a persistent connection.
2.1 Content-Length and Persistent Connections
The client know where one message ends and the next begins on persistent connections with correct Content-Length.
2.2 Content Encoding
If the body has been content-encoded, the Content-Length header specifies the length, in bytes, of the encoded body, not the length of the original, unencoded body.
3. Media Type and Charset
The Content-Type header field describes the MIME type of the entity body, the original entity body, before encoding.
3.1 Multipart Media Types
Each component is self-contained, with its own set of headers describing its content, the different components are concatenated together and delimited by a string.
3.2 Multipart Form Submissions
Requests:
4. Content Encoding
5. Chunked Encoding
6. Range Requests
Example:
7. Delta Encoding
Rather than sending the whole document, the client would get the page faster if the server sent just t he changes to the client's copy of the page.
Last updated