CURLOPT_PROXYPORT.md (1559B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_PROXYPORT 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLINFO_PRIMARY_PORT (3) 9 - CURLOPT_PORT (3) 10 - CURLOPT_PROXY (3) 11 - CURLOPT_PROXYTYPE (3) 12 Protocol: 13 - All 14 Added-in: 7.1 15 --- 16 17 # NAME 18 19 CURLOPT_PROXYPORT - port number the proxy listens on 20 21 # SYNOPSIS 22 23 ~~~c 24 #include <curl/curl.h> 25 26 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXYPORT, long port); 27 ~~~ 28 29 # DESCRIPTION 30 31 We discourage use of this option. 32 33 Pass a long with this option to set the proxy port to connect to unless it is 34 specified in the proxy string CURLOPT_PROXY(3) or uses 443 for https proxies 35 and 1080 for all others as default. 36 37 Disabling this option, setting it to zero, makes it not specified which makes 38 libcurl use the default proxy port number or the port number specified in the 39 proxy URL string. 40 41 While this accepts a 'long', the port number is 16 bit so it cannot be larger 42 than 65535. 43 44 # DEFAULT 45 46 0 47 48 # %PROTOCOLS% 49 50 # EXAMPLE 51 52 ~~~c 53 int 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 71 curl_easy_setopt(3) returns a CURLcode indicating success or error. 72 73 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 74 libcurl-errors(3).