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       Alt-Svc handling is disabled by default. If CURLOPT_ALTSVC(3)  is  set,
63       CURLOPT_ALTSVC_CTRL(3)   has   a   default   value   corresponding   to
64       CURLALTSVC_H1 | CURLALTSVC_H2 | CURLALTSVC_H3 - the HTTP/2  and  HTTP/3
65       bits are only set if libcurl was built with support for those versions.
66

PROTOCOLS

68       HTTPS
69

EXAMPLE

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

AVAILABILITY

79       Added in 7.64.1
80

RETURN VALUE

82       Returns  CURLE_OK  if the option is supported, and CURLE_UNKNOWN_OPTION
83       if not.
84

SEE ALSO

86       CURLOPT_ALTSVC(3), CURLOPT_CONNECT_TO(3), CURLOPT_RESOLVE(3),
87
88
89
90libcurl 7.69.1                 February 11, 2020        CURLOPT_ALTSVC_CTRL(3)
Impressum