1CURLMOPT_PUSHDATA(3) curl_multi_setopt options CURLMOPT_PUSHDATA(3)
2
3
4
6 CURLMOPT_PUSHDATA - pointer to pass to push callback
7
9 #include <curl/curl.h>
10
11 CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_PUSHDATA, void *pointer);
12
14 Set pointer to pass as the last argument to the CURLMOPT_PUSHFUNC‐
15 TION(3) callback. The pointer will not be touched or used by libcurl
16 itself, only passed on to the callback function.
17
19 NULL
20
22 HTTP(S)
23
25 /* only allow pushes for file names starting with "push-" */
26 int push_callback(CURL *parent,
27 CURL *easy,
28 size_t num_headers,
29 struct curl_pushheaders *headers,
30 void *userp)
31 {
32 char *headp;
33 int *transfers = (int *)userp;
34 FILE *out;
35 headp = curl_pushheader_byname(headers, ":path");
36 if(headp && !strncmp(headp, "/push-", 6)) {
37 fprintf(stderr, "The PATH is %s\n", headp);
38
39 /* save the push here */
40 out = fopen("pushed-stream", "wb");
41
42 /* write to this file */
43 curl_easy_setopt(easy, CURLOPT_WRITEDATA, out);
44
45 (*transfers)++; /* one more */
46
47 return CURL_PUSH_OK;
48 }
49 return CURL_PUSH_DENY;
50 }
51
52 curl_multi_setopt(multi, CURLMOPT_PUSHFUNCTION, push_callback);
53 curl_multi_setopt(multi, CURLMOPT_PUSHDATA, &counter);
54
56 Added in 7.44.0
57
59 Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION
60 if not.
61
63 CURLMOPT_PUSHFUNCTION(3), CURLMOPT_PIPELINING(3), CURLOPT_PIPEWAIT(3),
64 RFC7540
65
66
67
68libcurl 7.64.0 May 27, 2017 CURLMOPT_PUSHDATA(3)