http2hpack

Dynamic Table Updation Procedure in HTTP2


We have a query regarding our understanding in the stack of HTTP2 Protocol for Dynamic Table Updation. We want to get a clear understanding of the procedure for updating the dynamic table in case of remote end sends header frames in a sequence.

Sorry for bad english, hope you understand our concern.

Scenario :

  1. Suppose remote end 'R' wants to send two requests R1 and R2, but due to window limit R1 is split into two frames R1-F1 and R1-F2.
  2. Remote End 'R' then send the frames in this sequence
    *) R1-F1
    *) R2
    *) R1-F2

I want to know in this case when to update the dynamic table in remote end as well as local end for R1 request. As if we first update the dynamic table in remote end for R1 whole and then R2, then how will we sync the dynamic table in local end as R1 is fully received after R2.

Or We have to build the dynamic table for each frame irrespective of the total size of header of request ?


Solution

  • Remote End 'R' then send the frames in this sequence

    1. R1-F1
    2. R2
    3. R1-F2

    This is invalid, as specified in the HTTP/2 specification for CONTINUATION frames (https://datatracker.ietf.org/doc/html/rfc7540#section-6.10) that states:

    Any number of CONTINUATION frames can be sent, as long as the preceding frame is on the same stream and is a HEADERS, PUSH_PROMISE, or CONTINUATION frame without the END_HEADERS flag set.

    This means that in your case, the valid sequence of frames must be:

    1. R1-F1
    2. R1-F2
    3. R2

    Once the sequence is correct, updating the HPACK dynamic table is not a problem because request headers are always complete and sequential.