0

When a HTTP2 server has been configured to push a CSS page along with a request for a certain HTML page, it will send a PUSH_PROMISE frame to let the client know the push is coming.

If the CSS file is not found or cannot be read, etc. What should the server do? Should it send a 404 response on the stream for the PUSH_PROMISE, should it just do nothing, or is there some other way to handle a promise when the file is unavailable?

JPhi1618
  • 783
  • 1
  • 11
  • 21

1 Answers1

1

Sending a HTTP error such as 404 or 500 is probably fine - the browser will discard the content from the push cache and won't use it - it will instead request the resource explicitly.

Another option would be to reset the pushed stream via RST_STREAM. The server will send a PUSH_PROMISE followed by a RST_STREAM perhaps with a CANCEL_STREAM_ERROR as the error code for the RST_STREAM. The browser will understand that the pushed stream has been canceled by the server and won't consider the pushed stream - again it will instead request the resource explicitly.

sbordet
  • 16,856
  • 1
  • 50
  • 45
  • So its valid for the server to send a RST_STREAM in this situation? My (basic) understanding was that only a client would send that. – JPhi1618 Oct 15 '19 at 20:19
  • Looking at [this document](https://http2.github.io/http2-spec/), Section 5.1 does state: _A stream in the "reserved (local)" state is one that has been promised by sending a PUSH_PROMISE frame...Either endpoint can send a RST_STREAM frame to cause the stream to become "closed"._, so that seems to validate your position. – JPhi1618 Oct 15 '19 at 21:06