Encoding of HTTP messages within HTTP messages increases transfer rate

Source: Internet
Author: User

HTTP can transmit data in a direct way, but it can also increase the transmission rate by encoding during transmission. By encoding during transmission, a large number of access requests can be handled efficiently. However, the encoded operation requires the computer to complete, thus consuming more resources such as CPU.

The difference between the message body and the entity body

    • message : is the basic unit of HTTP communication, consisting of 8-bit byte streams, which are transmitted over HTTP traffic.

    • entity : The payload data is transmitted as a request or response, and its contents consist of the entity header and the entity body .

The body of an HTTP message is used to transfer the entity body of the request or response. Typically, the message body equals the entity body . The content of the entity body is changed only when it is encoded in the transmission, which causes it to differ from the message body.

Content encoding for compressed transmissions

When adding attachments to outgoing messages, in order to make the message smaller, we will compress the files before adding attachments. There is a feature called content encoding in the HTTP protocol that can perform similar operations. content Encoding indicates the encoding format applied on the entity content and keeps the entity information compressed as it is, and the content-encoded entity is received by the client and is responsible for decoding .

commonly used content encoding has the following types :

    • gzip(GNU Zip)

    • Compress(standard compression of UNIX systems)

    • deflate(zlib)

    • identity(not coded)

chunked transfer encoding for split sending

In the HTTP communication process, the requested encoding entity resource has not been fully transferred until the browser cannot display the request page. when transferring large volumes of data, by splitting the data into chunks, the browser is able to display the page progressively. This function, which blocks the entity body, is called chunked transmission encoding (Chunked Transfer Coding).

chunked Transfer Encoding divides the entity body into multiple parts ( blocks ). Each block is marked with hexadecimal, and the last piece of the entity body is marked with "0 (CR+LF)" . Entity principals that use chunked transfer encoding are decoded by the receiving client and revert to the entity body before the encoding. There is a mechanism called transfer encoding (Transfer Coding) in http/1.1 , which can be transmitted in a coded manner during communication, but only defined in the chunked transfer encoding .

Encoding of HTTP messages within HTTP messages increases transfer rate

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.