quickjs-tart

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

CURLOPT_REDIR_PROTOCOLS.md (2571B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_REDIR_PROTOCOLS
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLINFO_SCHEME (3)
      9   - CURLOPT_DEFAULT_PROTOCOL (3)
     10   - CURLOPT_PROTOCOLS (3)
     11   - CURLOPT_REDIR_PROTOCOLS_STR (3)
     12 Protocol:
     13   - HTTP
     14 Added-in: 7.19.4
     15 ---
     16 
     17 # NAME
     18 
     19 CURLOPT_REDIR_PROTOCOLS - protocols allowed to redirect to
     20 
     21 # SYNOPSIS
     22 
     23 ~~~c
     24 #include <curl/curl.h>
     25 
     26 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_REDIR_PROTOCOLS, long bitmask);
     27 ~~~
     28 
     29 # DESCRIPTION
     30 
     31 This option is deprecated. We strongly recommend using
     32 CURLOPT_REDIR_PROTOCOLS_STR(3) instead because this option cannot
     33 control all available protocols.
     34 
     35 Pass a long that holds a bitmask of protocol bits. If used, this bitmask
     36 limits what protocols libcurl may use in a transfer that it follows to in a
     37 redirect when CURLOPT_FOLLOWLOCATION(3) is enabled. This allows you to limit
     38 specific transfers to only be allowed to use a subset of protocols in
     39 redirections.
     40 
     41 Protocols denied by CURLOPT_PROTOCOLS(3) are not overridden by this
     42 option.
     43 
     44 By default libcurl allows HTTP, HTTPS, FTP and FTPS on redirect (7.65.2).
     45 *CURLPROTO_ALL* enables all protocols on redirect, including those
     46 otherwise disabled for security.
     47 
     48 These are the available protocol defines:
     49 ~~~c
     50 CURLPROTO_DICT
     51 CURLPROTO_FILE
     52 CURLPROTO_FTP
     53 CURLPROTO_FTPS
     54 CURLPROTO_GOPHER
     55 CURLPROTO_HTTP
     56 CURLPROTO_HTTPS
     57 CURLPROTO_IMAP
     58 CURLPROTO_IMAPS
     59 CURLPROTO_LDAP
     60 CURLPROTO_LDAPS
     61 CURLPROTO_POP3
     62 CURLPROTO_POP3S
     63 CURLPROTO_RTMP
     64 CURLPROTO_RTMPE
     65 CURLPROTO_RTMPS
     66 CURLPROTO_RTMPT
     67 CURLPROTO_RTMPTE
     68 CURLPROTO_RTMPTS
     69 CURLPROTO_RTSP
     70 CURLPROTO_SCP
     71 CURLPROTO_SFTP
     72 CURLPROTO_SMB
     73 CURLPROTO_SMBS
     74 CURLPROTO_SMTP
     75 CURLPROTO_SMTPS
     76 CURLPROTO_TELNET
     77 CURLPROTO_TFTP
     78 ~~~
     79 
     80 # DEFAULT
     81 
     82 HTTP, HTTPS, FTP and FTPS (Added in 7.65.2).
     83 
     84 Older versions defaulted to all protocols except FILE, SCP and since 7.40.0
     85 SMB and SMBS.
     86 
     87 # %PROTOCOLS%
     88 
     89 # EXAMPLE
     90 
     91 ~~~c
     92 int main(int argc, char **argv)
     93 {
     94   CURL *curl = curl_easy_init();
     95   if(curl) {
     96     /* pass in the URL from an external source */
     97     curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
     98 
     99     /* only allow redirects to HTTP and HTTPS URLs */
    100     curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS, (long)
    101                      CURLPROTO_HTTP | CURLPROTO_HTTPS);
    102 
    103     /* Perform the request */
    104     curl_easy_perform(curl);
    105   }
    106 }
    107 ~~~
    108 
    109 # DEPRECATED
    110 
    111 Deprecated since 7.85.0.
    112 
    113 # %AVAILABILITY%
    114 
    115 # RETURN VALUE
    116 
    117 curl_easy_setopt(3) returns a CURLcode indicating success or error.
    118 
    119 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
    120 libcurl-errors(3).