1CURLOPT_ALTSVC_CTRL(3)     curl_easy_setopt options     CURLOPT_ALTSVC_CTRL(3)
2
3
4

NAME

6       CURLOPT_ALTSVC_CTRL - control alt-svc behavior
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       #define CURLALTSVC_IMMEDIATELY  (1<<0)
12       #define CURLALTSVC_READONLYFILE (1<<2)
13       #define CURLALTSVC_H1           (1<<3)
14       #define CURLALTSVC_H2           (1<<4)
15       #define CURLALTSVC_H3           (1<<5)
16
17       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ALTSVC_CTRL, long bitmask);
18

EXPERIMENTAL

20       Warning:  this  feature is early code and is marked as experimental. It
21       can only be enabled by explicitly telling configure with  --enable-alt-
22       svc.  You are advised to not ship this in production before the experi‐
23       mental label is removed.
24

DESCRIPTION

26       Populate the long bitmask with the correct set of features to  instruct
27       libcurl how to handle Alt-Svc for the transfers using this handle.
28
29       libcurl will only accept Alt-Svc headers over a secure transport, mean‐
30       ing HTTPS. It will also only complete a request to an alternative  ori‐
31       gin  if  that  origin is properly hosted over HTTPS. These requirements
32       are there to make sure both the source and the destination are  legiti‐
33       mate.
34
35       Setting any bit will enable the alt-svc engine.
36
37       CURLALTSVC_IMMEDIATELY
38              If  an  Alt-Svc:  header  is received, this instructs libcurl to
39              switch to one of those alternatives asap rather than to save  it
40              and use for the next request. (Not currently supported).
41
42       CURLALTSVC_READONLYFILE
43              Do  not  write the alt-svc cache back to the file specified with
44              CURLOPT_ALTSVC(3) even if it gets updated.  By  default  a  file
45              specified with that option will be read and written to as deemed
46              necessary.
47
48       CURLALTSVC_H1
49              Accept alternative services offered over HTTP/1.1.
50
51       CURLALTSVC_H2
52              Accept alternative services offered over HTTP/2. This will  only
53              be  used  if  libcurl was also built to actually support HTTP/2,
54              otherwise this bit will be ignored.
55
56       CURLALTSVC_H3
57              Accept alternative services offered over HTTP/3. This will  only
58              be  used  if  libcurl was also built to actually support HTTP/3,
59              otherwise this bit will be ignored.
60

DEFAULT

62       0. No Alt-Svc treatment.
63

PROTOCOLS

65       HTTPS
66

EXAMPLE

68       CURL *curl = curl_easy_init();
69       if(curl) {
70         curl_easy_setopt(curl, CURLOPT_ALTSVC_CTRL, CURLALTSVC_H1);
71         curl_easy_setopt(curl, CURLOPT_ALTSVC, "altsvc-cache.txt");
72         curl_easy_perform(curl);
73       }
74

AVAILABILITY

76       Added in 7.64.1
77

RETURN VALUE

79       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
80       if not.
81

SEE ALSO

83       CURLOPT_ALTSVC(3), CURLOPT_CONNECT_TO(3), CURLOPT_RESOLVE(3),
84
85
86
87libcurl 7.66.0                  August 13, 2019         CURLOPT_ALTSVC_CTRL(3)
Impressum