Annotation of embedaddon/curl/docs/libcurl/opts/CURLMOPT_PUSHDATA.3, revision 1.1.1.1
1.1 misho 1: .\" **************************************************************************
2: .\" * _ _ ____ _
3: .\" * Project ___| | | | _ \| |
4: .\" * / __| | | | |_) | |
5: .\" * | (__| |_| | _ <| |___
6: .\" * \___|\___/|_| \_\_____|
7: .\" *
8: .\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
9: .\" *
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.
13: .\" *
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.
17: .\" *
18: .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19: .\" * KIND, either express or implied.
20: .\" *
21: .\" **************************************************************************
22: .\"
23: .TH CURLMOPT_PUSHDATA 3 "May 27, 2017" "libcurl 7.70.0" "curl_multi_setopt options"
24:
25: .SH NAME
26: CURLMOPT_PUSHDATA \- pointer to pass to push callback
27: .SH SYNOPSIS
28: .nf
29: #include <curl/curl.h>
30:
31: CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_PUSHDATA, void *pointer);
32: .fi
33: .SH DESCRIPTION
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.
37: .SH DEFAULT
38: NULL
39: .SH PROTOCOLS
40: HTTP(S)
41: .SH EXAMPLE
42: .nf
43: /* only allow pushes for file names starting with "push-" */
44: int push_callback(CURL *parent,
45: CURL *easy,
46: size_t num_headers,
47: struct curl_pushheaders *headers,
48: void *userp)
49: {
50: char *headp;
51: int *transfers = (int *)userp;
52: FILE *out;
53: headp = curl_pushheader_byname(headers, ":path");
54: if(headp && !strncmp(headp, "/push-", 6)) {
55: fprintf(stderr, "The PATH is %s\\n", headp);
56:
57: /* save the push here */
58: out = fopen("pushed-stream", "wb");
59:
60: /* write to this file */
61: curl_easy_setopt(easy, CURLOPT_WRITEDATA, out);
62:
63: (*transfers)++; /* one more */
64:
65: return CURL_PUSH_OK;
66: }
67: return CURL_PUSH_DENY;
68: }
69:
70: curl_multi_setopt(multi, CURLMOPT_PUSHFUNCTION, push_callback);
71: curl_multi_setopt(multi, CURLMOPT_PUSHDATA, &counter);
72: .fi
73: .SH AVAILABILITY
74: Added in 7.44.0
75: .SH RETURN VALUE
76: Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not.
77: .SH "SEE ALSO"
78: .BR CURLMOPT_PUSHFUNCTION "(3), " CURLMOPT_PIPELINING "(3), "
79: .BR CURLOPT_PIPEWAIT "(3), "
80: .BR RFC 7540
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>