xref: /curl/docs/libcurl/opts/CURLOPT_PROXYPORT.md (revision 5a488251)
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.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)
12Protocol:
13  - All
14Added-in: 7.1
15---
16
17# NAME
18
19CURLOPT_PROXYPORT - port number the proxy listens on
20
21# SYNOPSIS
22
23~~~c
24#include <curl/curl.h>
25
26CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYPORT, long port);
27~~~
28
29# DESCRIPTION
30
31We discourage use of this option.
32
33Pass a long with this option to set the proxy port to connect to unless it is
34specified in the proxy string CURLOPT_PROXY(3) or uses 443 for https proxies
35and 1080 for all others as default.
36
37Disabling this option, setting it to zero, makes it not specified which makes
38libcurl use the default proxy port number or the port number specified in the
39proxy URL string.
40
41While this accepts a 'long', the port number is 16 bit so it cannot be larger
42than 65535.
43
44# DEFAULT
45
460
47
48# %PROTOCOLS%
49
50# EXAMPLE
51
52~~~c
53int main(void)
54{
55  CURL *curl = curl_easy_init();
56  if(curl) {
57    CURLcode res;
58    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
59    curl_easy_setopt(curl, CURLOPT_PROXY, "localhost");
60    curl_easy_setopt(curl, CURLOPT_PROXYPORT, 8080L);
61    res = curl_easy_perform(curl);
62    curl_easy_cleanup(curl);
63  }
64}
65~~~
66
67# %AVAILABILITY%
68
69# RETURN VALUE
70
71Returns CURLE_OK
72