1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_PROXYAUTH
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_HTTPAUTH (3)
9  - CURLOPT_PROXY (3)
10  - CURLOPT_PROXYPORT (3)
11  - CURLOPT_PROXYTYPE (3)
12  - CURLOPT_PROXYUSERPWD (3)
13---
14
15# NAME
16
17CURLOPT_PROXYAUTH - HTTP proxy authentication methods
18
19# SYNOPSIS
20
21~~~c
22#include <curl/curl.h>
23
24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYAUTH, long bitmask);
25~~~
26
27# DESCRIPTION
28
29Pass a long as parameter, which is set to a bitmask, to tell libcurl which
30HTTP authentication method(s) you want it to use for your proxy
31authentication. If more than one bit is set, libcurl first queries the site to
32see what authentication methods it supports and then it picks the best one you
33allow it to use. For some methods, this induces an extra network round-trip.
34Set the actual name and password with the CURLOPT_PROXYUSERPWD(3)
35option.
36
37The bitmask can be constructed by the bits listed and described in the
38CURLOPT_HTTPAUTH(3) man page.
39
40# DEFAULT
41
42CURLAUTH_BASIC
43
44# PROTOCOLS
45
46HTTP
47
48# EXAMPLE
49
50~~~c
51int main(void)
52{
53  CURL *curl = curl_easy_init();
54  if(curl) {
55    CURLcode ret;
56    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
57    /* use this proxy */
58    curl_easy_setopt(curl, CURLOPT_PROXY, "http://local.example.com:1080");
59    /* allow whatever auth the proxy speaks */
60    curl_easy_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
61    /* set the proxy credentials */
62    curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, "james:007");
63    ret = curl_easy_perform(curl);
64    curl_easy_cleanup(curl);
65  }
66}
67~~~
68
69# AVAILABILITY
70
71Added in 7.10.7
72
73# RETURN VALUE
74
75Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
76CURLE_NOT_BUILT_IN if the bitmask specified no supported authentication
77methods.
78