Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the maximum chunk size in HTTP response with Transfer-Encoding chunked?

The w3.org (RFC2616) seems not to define a maximum size for chunks. But without a maximum chunk-size there is no space for the chunk-extension. There must be a maximum chunk-size, else I can't ignore the chunk-extension as I'm advised to do if it can't be understood (Quote:"MUST ignore chunk-extension extensions they do not understand").

like image 944
schwer Avatar asked Aug 14 '11 18:08

schwer


People also ask

What is Max chunk size?

Kierepka - As you mentioned, the upper limit for upload chunk is 50MB. Integration solutions can upload chunks of sizes from 1MB to 50MB.

What means transfer encoding chunked?

Chunked transfer encoding is a streaming data transfer mechanism available in version 1.1 of the Hypertext Transfer Protocol (HTTP). In chunked transfer encoding, the data stream is divided into a series of non-overlapping "chunks". The chunks are sent out and received independently of one another.

What is meant by HTTP chunking?

Chunking is a technique that HTTP servers use to improve responsiveness. Chunking can help you avoid situations where the server needs to obtain dynamic content from an external source and delays sending the response to the client until receiving all of the content so the server can calculate a Content-Length header.

What is chunk size?

The chunk-size field is a string of hex digits indicating the size of the chunk-data in octets. (in other words, the chunk length does not include the count of the octets in the chunk header and trailer). Oldest first Newest first.


2 Answers

The HTTP specification is pretty clear about the syntax of the HTTP messages.

The chunk size is always given as a hexadecimal number. If that number is not directly followed by a CRLF, but a ; instead, you know that there is an extension. This extension is identified by its name (chunk-ext-name). If you never heard of that particular name, you MUST ignore it.

So what exactly is your problem?

  • Read a hexadecimal number
  • Ignore everything up to the next CRLF
  • Be happy
like image 141
Roland Illig Avatar answered Oct 02 '22 21:10

Roland Illig


Each chunk extension must begin with a semi-colon and the list of chunk extensions must end with a CRLF. When parsing the chunk-size, stop at either a semi-colon or a CRLF. If you stopped at a semi-colon, ignore everything up to the next CRLF. There is no need for a maximum chunk-size.

chunk          = chunk-size [ chunk-extension ] CRLF
                 chunk-data CRLF

chunk-size     = 1*HEX

chunk-extension= *( ";" chunk-ext-name [ "=" chunk-ext-val ] )
like image 41
David Schwartz Avatar answered Oct 01 '22 21:10

David Schwartz