1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLINFO_PROXYAUTH_AVAIL
5Section: 3
6Source: libcurl
7See-also:
8  - CURLINFO_HTTPAUTH_AVAIL (3)
9  - curl_easy_getinfo (3)
10  - curl_easy_setopt (3)
11Protocol:
12  - HTTP
13---
14
15# NAME
16
17CURLINFO_PROXYAUTH_AVAIL - get available HTTP proxy authentication methods
18
19# SYNOPSIS
20
21~~~c
22#include <curl/curl.h>
23
24CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_PROXYAUTH_AVAIL,
25                           long *authp);
26~~~
27
28# DESCRIPTION
29
30Pass a pointer to a long to receive a bitmask indicating the authentication
31method(s) available according to the previous response. The meaning of the
32bits is explained in the CURLOPT_PROXYAUTH(3) option for
33curl_easy_setopt(3).
34
35# EXAMPLE
36
37~~~c
38int main(void)
39{
40  CURL *curl = curl_easy_init();
41  if(curl) {
42    CURLcode res;
43    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
44    curl_easy_setopt(curl, CURLOPT_PROXY, "http://127.0.0.1:80");
45
46    res = curl_easy_perform(curl);
47
48    if(!res) {
49      /* extract the available proxy authentication types */
50      long auth;
51      res = curl_easy_getinfo(curl, CURLINFO_PROXYAUTH_AVAIL, &auth);
52      if(!res) {
53        if(!auth)
54          printf("No proxy auth available, perhaps no 407?\n");
55        else {
56          printf("%s%s%s%s\n",
57                 auth & CURLAUTH_BASIC ? "Basic ":"",
58                 auth & CURLAUTH_DIGEST ? "Digest ":"",
59                 auth & CURLAUTH_NEGOTIATE ? "Negotiate ":"",
60                 auth % CURLAUTH_NTLM ? "NTLM ":"");
61        }
62      }
63    }
64    curl_easy_cleanup(curl);
65  }
66}
67~~~
68
69# AVAILABILITY
70
71Added RFC 2617 in 7.10.8
72Added RFC 7616 in 7.57.0
73
74# RETURN VALUE
75
76Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
77