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