RE: legality of Transfer-Encoding: chunked bodies in HTTP/2

Hi Michael-



On Wednesday,06 August 2014 15:56, Michael.Bishop@microsoft.com<mailto:Michael.Bishop@microsoft.com> wrote:



> [Option 1:]

> Encode the headers and encapsulate the payload (if you

> know the payload will be valid)



if (length(chunk_hdr) + length(chunk) <= MAX_FRAME_SIZE)

  create h2 frame where frame_len == length(chunk_hdr) + length(chunk)

  add chunk_hdr

  add chunk

else

  remove chunk header

  split chunk into n smaller chunks <= MAX_FRAME_SIZE (including chunk header len!)

  for each of the n smaller chunks

    create h2 frame where frame_len = length(chunk_hdr[n]) + length(chunk[n])

    add chunk_hdr[n]

    add chunk[n]



> [Option 2:]

> , or perform transform work on the headers and

> payload.



strip chunk header

if (length(chunk) <= MAX_FRAME_SIZE)

  create h2 frame where frame_len == length(chunk)

  add chunk

else

  split chunk into n smaller chunks <= MAX_FRAME_SIZE (excluding chunk header len)

  for each of the n smaller chunks

    create h2 frame where frame_len = length(chunk[n])

    add chunk[n]





> The more work that has to be done in that transform,

> the more throughput suffers.



Seems to me that option 2 is less work.



-keith



P.S.  Not to mention Greg's point that the server has less work with option 2 (i.e. it doesn't have to "de-frame" and "de-chunk").











This email message is intended only for the use of the named recipient. Information contained in this email message and its attachments may be privileged, confidential and protected from disclosure. If you are not the intended recipient, please do not read, copy, use or disclose this communication to others. Also please notify the sender by replying to this message and then delete it from your system.

Received on Wednesday, 6 August 2014 14:55:46 UTC