Skip to content

Understanding and controlling chunk size #2012

Closed Answered by seanmonstar
hangvane asked this question in Q&A
Discussion options

You must be logged in to vote

The size of each "chunk" is not really specified on purpose, but I can explain some of the current implementation details. The size of any chunk is based on these criteria:

  1. A single read is performed on the IO transport, and however much is read (from the TCP socket, or decrypted from TLS, etc) makes up the chunk.
  2. If the encoding is HTTP/1.1 "chunked", then whatever was read is checked for chunk delimiters, and if smaller than the bytes read, then it is sliced and only that part is give as a chunk. The remaining parts will be checked for the same thing on next poll.
  3. In HTTP/2, chunks come from DATA frames, which is kind of like chunked encoding.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@hangvane
Comment options

Answer selected by hangvane
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2010 on October 26, 2023 14:28.