quickjs-tart

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

CURLOPT_PROTOCOLS_STR.md (2501B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_PROTOCOLS_STR
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLINFO_SCHEME (3)
      9   - CURLOPT_DEFAULT_PROTOCOL (3)
     10   - CURLOPT_REDIR_PROTOCOLS_STR (3)
     11   - CURLOPT_URL (3)
     12   - curl_version_info (3)
     13 Protocol:
     14   - All
     15 Added-in: 7.85.0
     16 ---
     17 
     18 # NAME
     19 
     20 CURLOPT_PROTOCOLS_STR - allowed protocols
     21 
     22 # SYNOPSIS
     23 
     24 ~~~c
     25 #include <curl/curl.h>
     26 
     27 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROTOCOLS_STR, char *spec);
     28 ~~~
     29 
     30 # DESCRIPTION
     31 
     32 Pass a pointer to a string that holds a comma-separated list of case
     33 insensitive protocol names (URL schemes) to allow in the transfer. This
     34 option allows applications to use libcurl built to support a wide range of
     35 protocols but still limit specific transfers to only be allowed to use a
     36 subset of them. By default, libcurl accepts all protocols it was built with
     37 support for. See also CURLOPT_REDIR_PROTOCOLS_STR(3).
     38 
     39 If trying to set a non-existing protocol or if no matching protocol at all is
     40 set, it returns error.
     41 
     42 These are the available protocols:
     43 
     44 DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS,
     45 MQTT, POP3, POP3S, RTMP, RTMPE, RTMPS, RTMPT, RTMPTE, RTMPTS, RTSP, SCP, SFTP,
     46 SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS, WSS
     47 
     48 You can set "ALL" as a short-cut to enable all protocols. Note that by setting
     49 all, you may enable protocols that were not supported the day you write this
     50 but are introduced in a future libcurl version.
     51 
     52 curl_version_info(3) can be used to get a list of all supported protocols in
     53 the current libcurl. CURLINFO_SCHEME(3) is the recommended way to figure out
     54 the protocol used in a previous transfer.
     55 
     56 Using this option multiple times makes the last set string override the
     57 previous ones. Set it to NULL to restore to the internal default.
     58 
     59 # DEFAULT
     60 
     61 All protocols built-in
     62 
     63 # %PROTOCOLS%
     64 
     65 # EXAMPLE
     66 
     67 ~~~c
     68 int main(int argc, char **argv)
     69 {
     70   CURL *curl = curl_easy_init();
     71   if(curl) {
     72     /* pass in the URL from an external source */
     73     curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
     74 
     75     /* only allow HTTP, TFTP and SFTP */
     76     curl_easy_setopt(curl, CURLOPT_PROTOCOLS_STR, "http,tftp,sftp");
     77 
     78     /* Perform the request */
     79     curl_easy_perform(curl);
     80   }
     81 }
     82 ~~~
     83 
     84 # %AVAILABILITY%
     85 
     86 # RETURN VALUE
     87 
     88 Returns CURLE_UNKNOWN_OPTION if the option is not implemented,
     89 CURLE_UNSUPPORTED_PROTOCOL if a listed protocol is not supported or disabled,
     90 CURLE_BAD_FUNCTION_ARGUMENT if no protocol is listed else CURLE_OK.