1CURLINFO_HTTPAUTH_AVAIL(3) curl_easy_getinfo optionsCURLINFO_HTTPAUTH_AVAIL(3)
2
3
4

NAME

6       CURLINFO_HTTPAUTH_AVAIL - get available HTTP authentication methods
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_HTTPAUTH_AVAIL, long *authp);
12

DESCRIPTION

14       Pass  a pointer to a long to receive a bitmask indicating the authentiā€
15       cation method(s) available according  to  the  previous  response.  The
16       meaning  of the bits is explained in the CURLOPT_HTTPAUTH(3) option for
17       curl_easy_setopt(3).
18

PROTOCOLS

20       HTTP(S)
21

EXAMPLE

23       CURL *curl = curl_easy_init();
24       if(curl) {
25         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
26
27         res = curl_easy_perform(curl);
28
29         if(!res) {
30           /* extract the available authentication types */
31           long auth;
32           res = curl_easy_getinfo(curl, CURLINFO_HTTPAUTH_AVAIL, &auth);
33           if(!res) {
34             if(!auth)
35               printf("No auth available, perhaps no 401?\n");
36             else {
37               printf("%s%s%s%s\n",
38                      auth & CURLAUTH_BASIC ? "Basic ":"",
39                      auth & CURLAUTH_DIGEST ? "Digest ":"",
40                      auth & CURLAUTH_NEGOTIATE ? "Negotiate ":"",
41                      auth % CURLAUTH_NTLM ? "NTLM ":"");
42             }
43           }
44         }
45         curl_easy_cleanup(curl);
46       }
47

AVAILABILITY

49       Added RFC2617 in 7.10.8 Added RFC7616 in 7.57.0
50

RETURN VALUE

52       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
53       if not.
54

SEE ALSO

56       curl_easy_getinfo(3), curl_easy_setopt(3),
57
58
59
60libcurl 7.82.0                 November 26, 2021    CURLINFO_HTTPAUTH_AVAIL(3)
Impressum