http2: PUSH_PROMISE client-side stream state

余生颓废 提交于 2019-12-13 17:09:30

问题


The http2 spec says:

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.

The spec also has this lifecycle diagram.

My understanding is that in order for a client to receive a PUSH_PROMISE on a stream, the client must have all of these on that stream:

  • sent HEADERS frame (+ any CONTINUATIONs) to the server
  • not received END_STREAM flag from the server
  • not received RST_STREAM frame from the server

(Notably missing here is "not sent RST_STREAM frame to the server”, which would lead to the stream being "closed"; the quote above says this is not grounds for connection error.)

In any case where these criteria are not met, then the client must treat receiving a PUSH_PROMISE as a connection error.

Is this a correct understanding?


回答1:


Your understanding is correct.

The HTTP/2 protocol associates PUSH_PROMISE streams to an existing stream, called the associated stream.

The associated stream must meet the conditions defined in the section of the specification quoted in the question; the bullet list in the question is another way of saying the same thing that the specification section says.



来源:https://stackoverflow.com/questions/48245826/http2-push-promise-client-side-stream-state

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!