quickjs-tart

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

CURLOPT_REDIR_PROTOCOLS_STR.md (2696B)


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