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