1curl_pushheader_bynum(3) libcurl curl_pushheader_bynum(3)
2
3
4
6 curl_pushheader_bynum - get a push header by index
7
9 #include <curl/curl.h>
10
11 char *curl_pushheader_bynum(struct curl_pushheaders *h, size_t num);
12
14 This is a function that is only functional within a CURLMOPT_PUSHFUNC‐
15 TION(3) callback. It makes no sense to try to use it elsewhere and it
16 has no function then.
17
18 It returns the value for the header field at the given index num, for
19 the incoming server push request or NULL. The data pointed will be
20 freed when this callback returns. The returned pointer points to a
21 "name:value" string that will be freed when this callback returns.
22
23
25 /* output all the incoming push request headers */
26 int curl_push_callback(CURL *parent,
27 CURL *easy,
28 size_t num_headers,
29 struct curl_pushheaders *headers,
30 void *clientp)
31 {
32 sizt_t i = 0;
33 char *field;
34 do {
35 field = curl_pushheader_bynum(headers, i);
36 if(field)
37 fprintf(stderr, "Push header: %s\n", field);
38 i++;
39 } while(field);
40 return CURL_PUSH_OK; /* permission granted */
41 }
42
43 curl_multi_setopt(multi, CURLMOPT_PUSHFUNCTION, curl_push_callback);
44
46 Added in 7.44.0
47
49 Returns a pointer to the header field content or NULL.
50
52 CURLMOPT_PUSHFUNCTION(3),curl_pushheader_byname(3),
53
54
55
56libcurl 8.2.1 June 09, 2023 curl_pushheader_bynum(3)