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