2

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?

lf215
  • 1,185
  • 7
  • 41
  • 83
  • 1
    Your understanding could be correct, but the question is a bit ambiguous because it doesn't specify which end would have sent which frame, for the `RST_STREAM` and `HEADERS` frame in particular. – Frederik Deweerdt Jan 14 '18 at 14:27
  • I’ve updated the question – lf215 Jan 14 '18 at 15:53

1 Answers1

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.

sbordet
  • 16,856
  • 1
  • 50
  • 45