1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_PROXYUSERNAME
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_HTTPAUTH (3)
9  - CURLOPT_PROXYAUTH (3)
10  - CURLOPT_PROXYPASSWORD (3)
11  - CURLOPT_USERNAME (3)
12Protocol:
13  - All
14---
15
16# NAME
17
18CURLOPT_PROXYUSERNAME - username to use for proxy authentication
19
20# SYNOPSIS
21
22~~~c
23#include <curl/curl.h>
24
25CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYUSERNAME,
26                          char *username);
27~~~
28
29# DESCRIPTION
30
31Pass a char pointer as parameter, which should be pointing to the
32null-terminated username to use for the transfer.
33
34CURLOPT_PROXYUSERNAME(3) sets the username to be used in protocol
35authentication with the proxy.
36
37To specify the proxy password use the CURLOPT_PROXYPASSWORD(3).
38
39The application does not have to keep the string around after setting this
40option.
41
42# DEFAULT
43
44blank
45
46# EXAMPLE
47
48~~~c
49int main(void)
50{
51  CURL *curl = curl_easy_init();
52  if(curl) {
53    CURLcode res;
54    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
55    curl_easy_setopt(curl, CURLOPT_PROXY, "http://localhost:8080");
56    curl_easy_setopt(curl, CURLOPT_PROXYUSERNAME, "mrsmith");
57    curl_easy_setopt(curl, CURLOPT_PROXYPASSWORD, "qwerty");
58    res = curl_easy_perform(curl);
59    curl_easy_cleanup(curl);
60  }
61}
62~~~
63
64# AVAILABILITY
65
66Added in 7.19.1
67
68# RETURN VALUE
69
70Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
71CURLE_OUT_OF_MEMORY if there was insufficient heap space.
72