1 .\" **************************************************************************
3 .\" * Project ___| | | | _ \| |
4 .\" * / __| | | | |_) | |
5 .\" * | (__| |_| | _ <| |___
6 .\" * \___|\___/|_| \_\_____|
8 .\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
10 .\" * This software is licensed as described in the file COPYING, which
11 .\" * you should have received as part of this distribution. The terms
12 .\" * are also available at https://curl.haxx.se/docs/copyright.html.
14 .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 .\" * copies of the Software, and permit persons to whom the Software is
16 .\" * furnished to do so, under the terms of the COPYING file.
18 .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 .\" * KIND, either express or implied.
21 .\" **************************************************************************
23 .TH CURLMOPT_PUSHDATA 3 "May 27, 2017" "libcurl 7.59.0" "curl_multi_setopt options"
26 CURLMOPT_PUSHDATA \- pointer to pass to push callback
29 #include <curl/curl.h>
31 CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_PUSHDATA, void *pointer);
34 Set \fIpointer\fP to pass as the last argument to the
35 \fICURLMOPT_PUSHFUNCTION(3)\fP callback. The pointer will not be touched or
36 used by libcurl itself, only passed on to the callback function.
43 /* only allow pushes for file names starting with "push-" */
44 int push_callback(CURL *parent,
47 struct curl_pushheaders *headers,
51 int *transfers = (int *)userp;
53 headp = curl_pushheader_byname(headers, ":path");
54 if(headp && !strncmp(headp, "/push-", 6)) {
55 fprintf(stderr, "The PATH is %s\\n", headp);
57 /* save the push here */
58 out = fopen("pushed-stream", "wb");
60 /* write to this file */
61 curl_easy_setopt(easy, CURLOPT_WRITEDATA, out);
63 (*transfers)++; /* one more */
67 return CURL_PUSH_DENY;
70 curl_multi_setopt(multi, CURLMOPT_PUSHFUNCTION, push_callback);
71 curl_multi_setopt(multi, CURLMOPT_PUSHDATA, &counter);
76 Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not.
78 .BR CURLMOPT_PUSHFUNCTION "(3), " CURLMOPT_PIPELINING "(3), "
79 .BR CURLOPT_PIPEWAIT "(3), "