Closed guybedford closed 11 years ago
Protocol doesn't allow it, and it doesn't seem to be really useful. Just push it, and if browser already aware of it - it might cancel the stream. Or, on other hand, you can opt-out and not push it at all.
Consider if I have a CSS file that has 10 dependencies, and it then has to do a 304 for each one, we are better off just resending the CSS file each time. If there was a way to say that the CSS file is not modified, as well as pushing not-modified responses for the 10 dependencies, it would save a lot of back and fourth here.
It's unfortunate push streams don't work completely down to the protocol level like this, equivalent to making a request. Because then this caching behaviour would be ideal.
You should keep in mind, that you're not starting sending data (i.e. .push()
's callback isn't called) until the browser/client has acknowledged that he wants to receive data related to this PUSH stream. So, the right way to do it would be to just send them anyway and add etag header just in case.
Ok, thanks for clarifying. So if the etag was present, and matched the one already in the browser's cache, it wouldn't need to accept the push stream? That is very different to how I imagined it, and opens up some nice possibilities. Thanks for the help.
Unfortunately the above is not the case.
I have created a test repo here for this scenario https://github.com/guybedford/spdy-304-test and the etags are not considered in Chrome, only the maxAge header is respected for the push stream.
Do you think it's worth filing a bug report for this?
Well, it sounds like a right topic for discussion on spdy-dev@ mailing list.
I just wanted to check if this is possible to push 301 and 304 responses?
The use case is that a request for a file results in say three other files being pushed.
If there is a new request for that file, and the etag still matches, then the other three files will also have matching etags, so it would make sense to push the 304 responses.
Push doesn't seem to give the option of a different status code. Would this work in theory or would the protocol not allow this?