http2: PUSH_PROMISE 客户端流状态

http2: PUSH_PROMISE client-side stream state

http2 spec 说:

A receiver MUST treat the receipt of a PUSH_PROMISE on a stream that is neither "open" nor "half-closed (local)" as a connection error (Section 5.4.1) of type PROTOCOL_ERROR. However, an endpoint that has sent RST_STREAM on the associated stream MUST handle PUSH_PROMISE frames that might have been created before the RST_STREAM frame is received and processed.

规范也有这个 lifecycle diagram

我的理解是,为了让客户端在流上接收 PUSH_PROMISE,客户端必须在该流上具有 所有 个:

(这里值得注意的是 "not sent RST_STREAM frame to the server”, which would lead to the stream being "closed";上面的引用说这不是连接错误的理由。)

在任何不满足这些条件的情况下,客户端必须将收到 PUSH_PROMISE 视为连接错误。

这样理解正确吗?

你的理解是正确的。

HTTP/2 协议将 PUSH_PROMISE 流关联到现有流,称为 关联流

关联的流必须满足问题中引用的规范部分中定义的条件;问题中的项目符号列表是规范部分所说内容的另一种表达方式。