Sortix cross-nightly manual
This manual documents Sortix cross-nightly. You can instead view this document in the latest official manual.
curl_easy_nextheader(3) | Library Functions Manual | curl_easy_nextheader(3) |
NAME
curl_easy_nextheader - get the next HTTP headerSYNOPSIS
#include <curl/curl.h>
struct curl_header *curl_easy_nextheader(CURL *easy,
unsigned int origin,
int request,
struct curl_header *prev);
DESCRIPTION
This function lets an application iterate over all previously received HTTP headers.PROTOCOLS
This functionality affects http onlyEXAMPLE
int main(void)
{
struct curl_header *prev = NULL;
struct curl_header *h;
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_perform(curl);
/* extract the normal headers from the first request */
while((h = curl_easy_nextheader(curl, CURLH_HEADER, 0, prev))) {
printf("%s: %s\n", h->name, h->value);
prev = h;
}
/* extract the normal headers + 1xx + trailers from the last request */
unsigned int origin = CURLH_HEADER| CURLH_1XX | CURLH_TRAILER;
while((h = curl_easy_nextheader(curl, origin, -1, prev))) {
printf("%s: %s\n", h->name, h->value);
prev = h;
}
}
}
AVAILABILITY
Added in curl 7.83.0RETURN VALUE
This function returns the next header, or NULL when there are no more (matching) headers or an error occurred.SEE ALSO
curl_easy_header(3), curl_easy_perform(3)2024-11-24 | libcurl |