在同一资源的 http2 推送正在进行时触发 GET 请求时会发生什么

What happens when triggering a GET request while a http2 push is in-flight for the same resource

当触发单个 GET 请求时会发生什么,同时正在为同一资源发送 http2 推送?

指定的行为是什么以及浏览器实际做什么?

示例场景可能如下所示:

at time 0: GET / (get document) and the server pushes /data.json
at time 1: GET /data.json (triggered by script, while the h2 push is still not finished / in-flight)

这会导致两次调用服务器吗?这种行为是指定的还是特定于浏览器的,例如在 Chromium 中可能通过 HTTP 缓存:

The cache implements a single writer - multiple reader lock so that only one network request for the same resource is in flight at any given time. https://www.chromium.org/developers/design-documents/network-stack/http-cache

RFC 7540 中的 HTTP/2 规范 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.

因此,如果服务器开始发送的时间不会太长,那么请求似乎很可能会等待推送响应送达:

If the client determines, for any reason, that it does not wish to
receive the pushed response from the server or if the server takes
too long
to begin sending the promised response, the client can send
a RST_STREAM frame, using either the CANCEL or REFUSED_STREAM code
and referencing the pushed stream's identifier.