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_READONLYFILE (1<<2)
12       #define CURLALTSVC_H1           (1<<3)
13       #define CURLALTSVC_H2           (1<<4)
14       #define CURLALTSVC_H3           (1<<5)
15
16       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ALTSVC_CTRL, long bitmask);
17

DESCRIPTION

19       Populate  the long bitmask with the correct set of features to instruct
20       libcurl how to handle Alt-Svc for the transfers using this handle.
21
22       libcurl only accepts Alt-Svc headers over a secure  transport,  meaning
23       HTTPS. It will also only complete a request to an alternative origin if
24       that origin is properly hosted over HTTPS. These requirements are there
25       to make sure both the source and the destination are legitimate.
26
27       Alternative  services are only used when setting up new connections. If
28       there exists an existing connection to the host in the connection pool,
29       then that will be preferred.
30
31       Setting any bit will enable the alt-svc engine.
32
33       CURLALTSVC_READONLYFILE
34              Do  not  write the alt-svc cache back to the file specified with
35              CURLOPT_ALTSVC(3) even if it gets updated.  By  default  a  file
36              specified with that option will be read and written to as deemed
37              necessary.
38
39       CURLALTSVC_H1
40              Accept alternative services offered over HTTP/1.1.
41
42       CURLALTSVC_H2
43              Accept alternative services offered over HTTP/2. This will  only
44              be  used  if  libcurl was also built to actually support HTTP/2,
45              otherwise this bit will be ignored.
46
47       CURLALTSVC_H3
48              Accept alternative services offered over HTTP/3. This will  only
49              be  used  if  libcurl was also built to actually support HTTP/3,
50              otherwise this bit will be ignored.
51

DEFAULT

53       Alt-Svc handling is disabled by default. If CURLOPT_ALTSVC(3)  is  set,
54       CURLOPT_ALTSVC_CTRL(3)   has   a   default   value   corresponding   to
55       CURLALTSVC_H1 | CURLALTSVC_H2 | CURLALTSVC_H3 - the HTTP/2  and  HTTP/3
56       bits are only set if libcurl was built with support for those versions.
57

PROTOCOLS

59       HTTPS
60

EXAMPLE

62       CURL *curl = curl_easy_init();
63       if(curl) {
64         curl_easy_setopt(curl, CURLOPT_ALTSVC_CTRL, CURLALTSVC_H1);
65         curl_easy_setopt(curl, CURLOPT_ALTSVC, "altsvc-cache.txt");
66         curl_easy_perform(curl);
67       }
68

AVAILABILITY

70       Added in 7.64.1
71

RETURN VALUE

73       Returns  CURLE_OK  if the option is supported, and CURLE_UNKNOWN_OPTION
74       if not.
75

SEE ALSO

77       CURLOPT_ALTSVC(3), CURLOPT_CONNECT_TO(3), CURLOPT_RESOLVE(3),
78
79
80
81libcurl 7.85.0                   May 17, 2022           CURLOPT_ALTSVC_CTRL(3)
Impressum