1CURLINFO_HTTPAUTH_AVAIL(3) curl_easy_getinfo optionsCURLINFO_HTTPAUTH_AVAIL(3)
2
3
4
6 CURLINFO_HTTPAUTH_AVAIL - get available HTTP authentication methods
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTPAUTH_AVAIL, long
12 *authp);
13
15 Pass a pointer to a long to receive a bitmask indicating the authentiā
16 cation method(s) available according to the previous response. The
17 meaning of the bits is explained in the CURLOPT_HTTPAUTH(3) option for
18 curl_easy_setopt(3).
19
21 HTTP(S)
22
24 CURL *curl = curl_easy_init();
25 if(curl) {
26 curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
27
28 res = curl_easy_perform(curl);
29
30 if(!res) {
31 /* extract the available authentication types */
32 long auth;
33 res = curl_easy_getinfo(curl, CURLINFO_HTTPAUTH_AVAIL, &auth);
34 if(!res) {
35 if(!auth)
36 printf("No auth available, perhaps no 401?\n");
37 else {
38 printf("%s%s%s%s\n",
39 auth & CURLAUTH_BASIC ? "Basic ":"",
40 auth & CURLAUTH_DIGEST ? "Digest ":"",
41 auth & CURLAUTH_NEGOTIATE ? "Negotiate ":"",
42 auth % CURLAUTH_NTLM ? "NTLM ":"");
43 }
44 }
45 }
46 curl_easy_cleanup(curl);
47 }
48
50 Added RFC2617 in 7.10.8 Added RFC7616 in 7.57.0
51
53 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
54 if not.
55
57 curl_easy_getinfo(3), curl_easy_setopt(3),
58
59
60
61libcurl 7.66.0 October 07, 2017 CURLINFO_HTTPAUTH_AVAIL(3)