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