1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_PROXYPORT
5Section: 3
6Source: libcurl
7See-also:
8  - CURLINFO_PRIMARY_PORT (3)
9  - CURLOPT_PORT (3)
10  - CURLOPT_PROXY (3)
11  - CURLOPT_PROXYTYPE (3)
12---
13
14# NAME
15
16CURLOPT_PROXYPORT - port number the proxy listens on
17
18# SYNOPSIS
19
20~~~c
21#include <curl/curl.h>
22
23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYPORT, long port);
24~~~
25
26# DESCRIPTION
27
28We discourage use of this option.
29
30Pass a long with this option to set the proxy port to connect to unless it is
31specified in the proxy string CURLOPT_PROXY(3) or uses 443 for https
32proxies and 1080 for all others as default.
33
34While this accepts a 'long', the port number is 16 bit so it cannot be larger
35than 65535.
36
37# DEFAULT
38
390, not specified which makes it use the default port
40
41# PROTOCOLS
42
43All
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, "localhost");
55    curl_easy_setopt(curl, CURLOPT_PROXYPORT, 8080L);
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
69