Search code examples
http2

http/2: client PUSH_PROMISE frame acceptance


The spec says:

Once a client receives a PUSH_PROMISE frame and chooses to accept the pushed response, the client SHOULD NOT issue any requests for the promised response until after the promised stream has closed.

Does this explain the quote:

The client should not make any requests to the locally stored promised content until after the promised stream has closed. Presumably this is because the client should wait for the all the promised content to arrive locally; reading before the stream is closed might have incomplete information.


Solution

  • The spec says that the client should not issue any request for the promised resource; the quote talks about accessing the promised resource data on the client; the two things are related but independent.

    I think the answer depends on the implementation of the client.

    For example, if the pushed resource is an image, a client may decide to start rendering the image with the data that has already arrived - even if not complete yet, and continue to render the image as the data arrives.

    The same could possibly be applied to a pushed CSS: the client may start parsing it with the data that has already arrived - even if not complete; this does not mean that the client may apply the CSS to the DOM, just that it will parse it.

    A browser may decide that it is better to wait for the pushed resources to be complete before accessing them; but in general a client need not to wait, and certainly the specification does not mandate any behavior about accessing the pushed resource on the client.