quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CURLOPT_PRE_PROXY.md (2449B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_PRE_PROXY
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLOPT_HTTPPROXYTUNNEL (3)
      9   - CURLOPT_PROXY (3)
     10 Protocol:
     11   - All
     12 Added-in: 7.52.0
     13 ---
     14 
     15 # NAME
     16 
     17 CURLOPT_PRE_PROXY - pre-proxy host to use
     18 
     19 # SYNOPSIS
     20 
     21 ~~~c
     22 #include <curl/curl.h>
     23 
     24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PRE_PROXY, char *preproxy);
     25 ~~~
     26 
     27 # DESCRIPTION
     28 
     29 Set the *preproxy* to use for the upcoming request. The parameter should be a
     30 char * to a null-terminated string holding the hostname or dotted numerical IP
     31 address. A numerical IPv6 address must be written within [brackets].
     32 
     33 To specify port number in this string, append :[port] to the end of the host
     34 name. The proxy's port number may optionally be specified with the separate
     35 option CURLOPT_PROXYPORT(3). If not specified, libcurl defaults to using
     36 port 1080 for proxies.
     37 
     38 A pre proxy is a SOCKS proxy that curl connects to before it connects to the
     39 HTTP(S) proxy specified in the CURLOPT_PROXY(3) option. The pre proxy
     40 can only be a SOCKS proxy.
     41 
     42 The pre proxy string should be prefixed with [scheme]:// to specify which kind
     43 of socks is used. Use socks4://, socks4a://, socks5:// or socks5h:// (the last
     44 one to enable socks5 and asking the proxy to do the resolving, also known as
     45 *CURLPROXY_SOCKS5_HOSTNAME* type) to request the specific SOCKS version to
     46 be used. Otherwise SOCKS4 is used as default.
     47 
     48 Setting the pre proxy string to "" (an empty string) explicitly disables the
     49 use of a pre proxy.
     50 
     51 When you set a hostname to use, do not assume that there is any particular
     52 single port number used widely for proxies. Specify it.
     53 
     54 The application does not have to keep the string around after setting this
     55 option.
     56 
     57 Using this option multiple times makes the last set string override the
     58 previous ones. Set it to NULL to disable its use again.
     59 
     60 # DEFAULT
     61 
     62 NULL
     63 
     64 # %PROTOCOLS%
     65 
     66 # EXAMPLE
     67 
     68 ~~~c
     69 int main(void)
     70 {
     71   CURL *curl = curl_easy_init();
     72   if(curl) {
     73     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/file.txt");
     74     curl_easy_setopt(curl, CURLOPT_PRE_PROXY, "socks4://socks-proxy:1080");
     75     curl_easy_setopt(curl, CURLOPT_PROXY, "http://proxy:80");
     76     curl_easy_perform(curl);
     77   }
     78 }
     79 ~~~
     80 
     81 # %AVAILABILITY%
     82 
     83 # RETURN VALUE
     84 
     85 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     86 
     87 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     88 libcurl-errors(3).