Sortix cross-nightly manual
This manual documents Sortix cross-nightly. You can instead view this document in the latest official manual.
curl_easy_header(3) | Library Functions Manual | curl_easy_header(3) |
NAME
curl_easy_header - get an HTTP headerSYNOPSIS
#include <curl/curl.h>
CURLHcode curl_easy_header(CURL *easy,
const char *name,
size_t index,
unsigned int origin,
int request,
struct curl_header **hout);
DESCRIPTION
curl_easy_header(3) returns a pointer to a "curl_header" struct in hout with data for the HTTP response header name. The case insensitive null-terminated header name should be specified without colon.The header struct
struct curl_header {
char *name;
char *value;
size_t amount;
size_t index;
unsigned int origin;
void *anchor;
};
ORIGINS
- CURLH_HEADER
- The header arrived as a header from the server.
- CURLH_TRAILER
- The header arrived as a trailer. A header that arrives after the body.
- CURLH_CONNECT
- The header arrived in a CONNECT response. A CONNECT request is being done to setup a transfer "through" an HTTP(S) proxy.
- CURLH_1XX
- The header arrived in an HTTP 1xx response. A 1xx response is an "intermediate" response that might happen before the "real" response.
- CURLH_PSEUDO
- The header is an HTTP/2 or HTTP/3 pseudo header
PROTOCOLS
This functionality affects http onlyEXAMPLE
int main(void)
{
struct curl_header *type;
CURL *curl = curl_easy_init();
if(curl) {
CURLHcode h;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_perform(curl);
h = curl_easy_header(curl, "Content-Type", 0, CURLH_HEADER, -1, &type);
curl_easy_cleanup(curl);
}
}
AVAILABILITY
Added in curl 7.83.0RETURN VALUE
This function returns a CURLHcode indicating success or error.SEE ALSO
CURLINFO_CONTENT_TYPE(3), CURLOPT_HEADERFUNCTION(3), curl_easy_nextheader(3), curl_easy_perform(3), libcurl-errors(3)2024-11-24 | libcurl |