curl_pushheader_bynum(3)
π¦ NAME π¦
okay so this page is all about curl_pushheader_bynum(3) β get a push header by index. that's the whole mission, bestie π
.
β¨ SYNOPSIS β¨
#include <curl/curl.h>
char *curl_pushheader_bynum(struct curl_pushheaders *h, size_t num);
π DESCRIPTION π
so curl_pushheader_bynum is a function that is only functional inside a CURLMOPT_PUSHFUNCTION(3) callback. trying to use it anywhere else? literally makes no sense, and it has no function then β no cap π.
it returns the value for the header field at the given index num, for the incoming server push request β or NULL. the data it points to is freed by libcurl when this callback returns. the returned pointer points to a "name:value" string that gets freed when this callback returns; even though its type doesn't constrain it, this string may not be altered. so look, don't touch, okay? πβ¨
π PROTOCOLS π
this functionality affects http only. that's the whole guest list, periodt π
.
π EXAMPLE π
here's the example β it outputs all the incoming push request headers:
/* output all the incoming push request headers */
static int push_cb(CURL *parent,
CURL *easy,
size_t num_headers,
struct curl_pushheaders *headers,
void *clientp)
{
int i = 0;
char *field;
do {
field = curl_pushheader_bynum(headers, i);
if(field)
fprintf(stderr, "Push header: %s\n", field);
i++;
} while(field);
return CURL_PUSH_OK; /* permission granted */
}
int main(void)
{
CURLM *multi = curl_multi_init();
curl_multi_setopt(multi, CURLMOPT_PUSHFUNCTION, push_cb);
}
β AVAILABILITY β
added in curl 7.44.0 β iconic since then, honestly π.
π₯ RETURN VALUE π₯
returns a pointer to the header field content or NULL. simple, slay, done π«Ά.
π«Ά SEE ALSO π«Ά
π that's the whole page, bestie! this one's from the libcurl manual and it's dated 2026-10-12 β bye, go read those see-alsos ππΈ
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms