1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_PROXYUSERPWD
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_PROXY (3)
9  - CURLOPT_PROXYPASSWORD (3)
10  - CURLOPT_PROXYTYPE (3)
11  - CURLOPT_PROXYUSERNAME (3)
12---
13
14# NAME
15
16CURLOPT_PROXYUSERPWD - user name and password to use for proxy authentication
17
18# SYNOPSIS
19
20~~~c
21#include <curl/curl.h>
22
23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYUSERPWD, char *userpwd);
24~~~
25
26# DESCRIPTION
27
28Pass a char pointer as parameter, which should be [user name]:[password] to
29use for the connection to the HTTP proxy. Both the name and the password are
30URL decoded before used, so to include for example a colon in the user name
31you should encode it as %3A. (This is different to how CURLOPT_USERPWD(3) is
32used - beware.)
33
34Use CURLOPT_PROXYAUTH(3) to specify the authentication method.
35
36The application does not have to keep the string around after setting this
37option.
38
39# DEFAULT
40
41This is NULL by default.
42
43# PROTOCOLS
44
45Used with all protocols that can use a proxy
46
47# EXAMPLE
48
49~~~c
50int main(void)
51{
52  CURL *curl = curl_easy_init();
53  if(curl) {
54    CURLcode res;
55    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
56    curl_easy_setopt(curl, CURLOPT_PROXY, "http://localhost:8080");
57    curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, "clark%20kent:superman");
58    res = curl_easy_perform(curl);
59    curl_easy_cleanup(curl);
60  }
61}
62~~~
63
64# AVAILABILITY
65
66Always
67
68# RETURN VALUE
69
70Returns CURLE_OK if proxies are supported, CURLE_UNKNOWN_OPTION if not, or
71CURLE_OUT_OF_MEMORY if there was insufficient heap space.
72