quickjs-tart

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

CURLOPT_ALTSVC_CTRL.md (2604B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_ALTSVC_CTRL
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLOPT_ALTSVC (3)
      9   - CURLOPT_CONNECT_TO (3)
     10   - CURLOPT_RESOLVE (3)
     11 Protocol:
     12   - HTTP
     13 Added-in: 7.64.1
     14 ---
     15 
     16 # NAME
     17 
     18 CURLOPT_ALTSVC_CTRL - control alt-svc behavior
     19 
     20 # SYNOPSIS
     21 
     22 ~~~c
     23 #include <curl/curl.h>
     24 
     25 #define CURLALTSVC_READONLYFILE (1<<2)
     26 #define CURLALTSVC_H1           (1<<3)
     27 #define CURLALTSVC_H2           (1<<4)
     28 #define CURLALTSVC_H3           (1<<5)
     29 
     30 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ALTSVC_CTRL, long bitmask);
     31 ~~~
     32 
     33 # DESCRIPTION
     34 
     35 Populate the long *bitmask* with the correct set of features to instruct
     36 libcurl how to handle Alt-Svc for the transfers using this handle.
     37 
     38 libcurl only accepts Alt-Svc headers over HTTPS. It also only completes a
     39 request to an alternative origin if that origin is properly hosted over HTTPS.
     40 These requirements are there to make sure both the source and the destination
     41 are legitimate.
     42 
     43 Alternative services are only used when setting up new connections. If there
     44 exists an existing connection to the host in the connection pool, then that is
     45 preferred.
     46 
     47 If CURLOPT_ALTSVC(3) is set, CURLOPT_ALTSVC_CTRL(3) gets a default value
     48 corresponding to CURLALTSVC_H1 | CURLALTSVC_H2 | CURLALTSVC_H3 - the HTTP/2
     49 and HTTP/3 bits are only set if libcurl was built with support for those
     50 versions.
     51 
     52 Setting any bit enables the alt-svc engine.
     53 
     54 ## CURLALTSVC_READONLYFILE
     55 
     56 Do not write the alt-svc cache back to the file specified with
     57 CURLOPT_ALTSVC(3) even if it gets updated. By default a file specified
     58 with that option is read and written to as deemed necessary.
     59 
     60 ## CURLALTSVC_H1
     61 
     62 Accept alternative services offered over HTTP/1.1.
     63 
     64 ## CURLALTSVC_H2
     65 
     66 Accept alternative services offered over HTTP/2. This is only used if libcurl
     67 was also built to actually support HTTP/2, otherwise this bit is ignored.
     68 
     69 ## CURLALTSVC_H3
     70 
     71 Accept alternative services offered over HTTP/3. This is only used if libcurl
     72 was also built to actually support HTTP/3, otherwise this bit is ignored.
     73 
     74 # DEFAULT
     75 
     76 0 - Alt-Svc handling is disabled
     77 
     78 # %PROTOCOLS%
     79 
     80 # EXAMPLE
     81 
     82 ~~~c
     83 int main(void)
     84 {
     85   CURL *curl = curl_easy_init();
     86   if(curl) {
     87     curl_easy_setopt(curl, CURLOPT_ALTSVC_CTRL, (long)CURLALTSVC_H1);
     88     curl_easy_setopt(curl, CURLOPT_ALTSVC, "altsvc-cache.txt");
     89     curl_easy_perform(curl);
     90   }
     91 }
     92 ~~~
     93 
     94 # %AVAILABILITY%
     95 
     96 # RETURN VALUE
     97 
     98 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     99 
    100 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
    101 libcurl-errors(3).