cURL / Mailing Lists / curl-library / Single Mail

curl-library

how to use http/2 server push?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 4 May 2015 14:11:20 +0200 (CEST)

Hey

Anyone around who has been thinking about using HTTP/2 and server push in an
application? Server push means that a new stream is initiated from the server
without the client specifically asking for it. Typically it would be resource
B that the server thinks the client wants since it asked for resource A. Like
in a web scenario it could be the CSS if the client asked for the html.

A client can of course deny it (or disallow it completely in the first place),
but how would you like the API for libcurl to expose this functionality?

Method 1:

I started out thinking we should have an option that allows us to setup an
easy handle and add it to the multi handle just idling until the server
(might) do a push. This is rather inflexible and forces the application to
know before-hand how many pushed streams it'd like.

Method 2:

We would (somehow) dynamically create a new easy handle and stream for a
pushed resource and allow the application to deny it or to receive it like an
ordinary transfer. The creation of the easy handle would probably then have to
be presented to the application with a callback or something and the
application would then have to setup options etc for the transfer (like write
callback etc). We could also imagine the application being allowed to cancel
such a request.

Method 3:

I'm sure we can think of other ways. What do you think?

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2015-05-04