http/2 push promise 权限伪 header

http/2 push promise authority pseudo header

http2 rfc http://httpwg.org/specs/rfc7540.html 说:

All HTTP/2 requests MUST include exactly one valid value for the :method, :scheme, and :path pseudo-header fields

(注意不含权限)

推送承诺:

The server MUST include a value in the :authority pseudo-header field for which the server is authoritative

我的问题是,对于服务器推送承诺请求帧,服务器是否需要始终包含权限伪 header 或者如果它决定包含它,那么它必须是服务器对其具有权威性的权限?

我认为 :authority header 必须始终包含在 PUSH_PROMISE 帧中,因为客户端可能对不同的主机名使用相同的连接,如果证书并相应地解析 IP 地址。

通过添加权限框架,客户端将在推送的资源和需要检索的资源之间进行精确匹配。

如果没有 :authority header,客户端可能会认为推送的资源是 https://example.com/background.png,但后来在从 example.com 下载的 HTML 中发现资源改为 https://images.example.com/background.png;由于 URI 不匹配,客户端将发出对该资源的请求,而不是使用推送的资源。

除此解释外,您可以尝试在没有 :authority 的情况下发出 PUSH_PROMISE 并查看各种浏览器的行为方式:有时会使用实现行为来加强规范。