chunked encoding of the HTTP protocol

Source: Internet
Author: User

In general, the header of HTTP contains the Content-length field to indicate the length of the newspaper style. Such as:

Sometimes the service generates HTTP response is unable to determine the size of the message, such as large file download, or the background requires complex logic to all the page request, when the need to generate a real-time message length, the server generally use chunked encoding.

In the chunked encoded transmission, the headers of the reply message has a transfer-coding domain value of chunked, indicating that the content will be transmitted in chunked encoding. Use chunked encoded headers as follows (you can use Firefox's firebug plugin or httpwatch to view headers information, HttpWatch can also see the number of chunked):

The chunked is encoded in the following ways:

Chunked-body=*chunk
"0" CRLF
Footer
CRLF
Chunk=chunk-size[chunk-ext]crlf
Chunk-datacrlf
Hex-no-zero=Chunk-size=hex-no-zero*hex
Chunk-ext=* (";" chunk-ext-name["=" chunk-ext-value])
Chunk-ext-name=token
Chunk-ext-val=tokenquoted-string
Chunk-data=chunk-size (OCTET)
Footer=*entity-header

The encoding consists of a number of chunk consisting of a chunk with a length of 0, each of which consists of two parts, the first part is the length and length of the chunk (generally not written), the second part is the content of the specified length, and each part is separated by CRLF. In the last chunk of length 0 is the content called footer, which is something that is not written in the header content.

From:http://www.cnblogs.com/zhaozhan/archive/2010/08/24/1807639.html

chunked encoding of the HTTP protocol

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.