zostay / RakuWAPI

The Web API for Raku (RakuWAPI)
Artistic License 2.0
24 stars 5 forks source link

Define the role of p6sgix.h2c.push-promise in more detail #27

Open zostay opened 9 years ago

zostay commented 9 years ago

Basically, the push-promise should only be used to emit a list of pairs, describing the request header. This looks something like:

%env<p6sgix.h2c.push-promise>.emit([
    ':method' => 'GET',
    ':scheme' => 'http',
    ':path' => '/file.png',
]);

The server is required to send the appropriate PUSH_PROMISE frame to the client in a new stream. It is required to make a followup call to the app to initiate a request matching the given headers so that the application can fulfill the response it promised.

This way an application can check to see if the protocol is HTTP/2. If it is, it can spew out whatever pushes should be initiated for the current request. If not, the client should end up making those requests anyway and can be fulfilled by the application the same way when either the client requests it or the server pushes it.