1CURLOPT_ALTSVC_CTRL(3) curl_easy_setopt options CURLOPT_ALTSVC_CTRL(3)
2
3
4
6 CURLOPT_ALTSVC_CTRL - control alt-svc behavior
7
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
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 will only accept Alt-Svc headers over a secure transport, mean‐
23 ing HTTPS. It will also only complete a request to an alternative ori‐
24 gin if that origin is properly hosted over HTTPS. These requirements
25 are there to make sure both the source and the destination are legiti‐
26 mate.
27
28 Setting any bit will enable the alt-svc engine.
29
30 CURLALTSVC_READONLYFILE
31 Do not write the alt-svc cache back to the file specified with
32 CURLOPT_ALTSVC(3) even if it gets updated. By default a file
33 specified with that option will be read and written to as deemed
34 necessary.
35
36 CURLALTSVC_H1
37 Accept alternative services offered over HTTP/1.1.
38
39 CURLALTSVC_H2
40 Accept alternative services offered over HTTP/2. This will only
41 be used if libcurl was also built to actually support HTTP/2,
42 otherwise this bit will be ignored.
43
44 CURLALTSVC_H3
45 Accept alternative services offered over HTTP/3. This will only
46 be used if libcurl was also built to actually support HTTP/3,
47 otherwise this bit will be ignored.
48
50 Alt-Svc handling is disabled by default. If CURLOPT_ALTSVC(3) is set,
51 CURLOPT_ALTSVC_CTRL(3) has a default value corresponding to
52 CURLALTSVC_H1 | CURLALTSVC_H2 | CURLALTSVC_H3 - the HTTP/2 and HTTP/3
53 bits are only set if libcurl was built with support for those versions.
54
56 HTTPS
57
59 CURL *curl = curl_easy_init();
60 if(curl) {
61 curl_easy_setopt(curl, CURLOPT_ALTSVC_CTRL, CURLALTSVC_H1);
62 curl_easy_setopt(curl, CURLOPT_ALTSVC, "altsvc-cache.txt");
63 curl_easy_perform(curl);
64 }
65
67 Added in 7.64.1
68
70 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
71 if not.
72
74 CURLOPT_ALTSVC(3), CURLOPT_CONNECT_TO(3), CURLOPT_RESOLVE(3),
75
76
77
78libcurl 7.79.1 November 04, 2020 CURLOPT_ALTSVC_CTRL(3)