cURL / Mailing Lists / curl-library / Single Mail

curl-library

HTTP/2 server push, callback?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 27 May 2015 17:06:07 +0200 (CEST)

Hi again,

We're in feature-freeze mode for this pending release but that will end with a
release in three weeks and then we'll be open for new features again. I
thought I'd throw some server push ideas in the mean time and see if anyone
has ideas or improvements for them!

I imagine two new options:

- CURLMOPT_PUSHFUNCTION [callback]
   CURLMOPT_PUSHDATA [callback user pointer]

These are two new options for curl_multi_setopt()

Without the CURLMOPT_PUSHFUNCTION set, pushed streams will be refused.

This is how the callback would work:

int curl_stream_push(CURL *newhandle,
                      unsigned int stream_id,
                      struct curl_push *headers,
                      void *userp);

This callback gets called when a new stream is being pushed by the
server. The 'newhandle' is a newly created easy handle that represents this
new transfer. This handle is otherwise "naked" and will need a suitable set of
options set before it will work the way the application wants it to.

If the callback returns positively, the new easy handle will be added to the
multi handle automatically.

struct curl_push {
   const char *method; /* example: "GET" */
   const char *path; /* example: "/download-154/image.png" */
   const char *scheme; /* example: "https" */
   const char *authority; /* example: "www.example.com:443" */
};

The callback returns one of:

CURL_PUSH_OK - we have accepted the stream and it can now start receiving
                  data, the ownership of the CURL handle has been taken over by
                  the application.

CURL_PUSH_DENY - the callback denies the stream and no data for this will
                  reach the application, the easy handle will be destroyed by
                  libcurl

  * - all other return codes are reserved for future use

Thoughts?

-- 
  / 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-27