1CURLOPT_ALTSVC(3) curl_easy_setopt options CURLOPT_ALTSVC(3)
2
3
4
6 CURLOPT_ALTSVC - alt-svc cache file name
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ALTSVC, char *filename);
12
14 Pass in a pointer to a filename to instruct libcurl to use that file as
15 the Alt-Svc cache to read existing cache contents from and possibly
16 also write it back to a after a transfer, unless CURLALTSVC_READONLY‐
17 FILE is set in CURLOPT_ALTSVC_CTRL(3).
18
19 Specify a blank file name ("") to make libcurl not load from a file at
20 all.
21
23 NULL. The alt-svc cache is not read nor written to file.
24
26 HTTPS
27
29 CURL *curl = curl_easy_init();
30 if(curl) {
31 curl_easy_setopt(curl, CURLOPT_ALTSVC_CTRL, CURLALTSVC_H1);
32 curl_easy_setopt(curl, CURLOPT_ALTSVC, "altsvc-cache.txt");
33 curl_easy_perform(curl);
34 }
35
37 A text based file with one line per alt-svc entry and each line con‐
38 sists of nine space-separated fields.
39
40 An example line could look like
41
42 h2 www.example 8443 h3 quic.example 443 "20190808 06:18:37" 1 0
43
44 The fields of that line are:
45
46
47 h2 ALPN id for the source origin
48
49 www.example
50 Host name for the source origin
51
52 8443 Port number for the source origin
53
54 h3 ALPN id for the destination host
55
56 quic.example
57 Host name for the destination host
58
59 443 Port number for the destination host
60
61 2019* Expiration date and time of this entry within double quotes. The
62 date format is "YYYYMMDD HH:MM:SS" and the time zone is GMT.
63
64 1 Boolean (1 or 0) if "persist" was set for this entry
65
66 0 Integer priority value (not currently used)
67
69 Added in 7.64.1
70
72 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
73 if not.
74
76 CURLOPT_ALTSVC_CTRL(3), CURLOPT_CONNECT_TO(3), CURLOPT_RESOLVE(3), CUR‐
77 LOPT_COOKIEFILE(3),
78
79
80
81libcurl 7.85.0 June 21, 2022 CURLOPT_ALTSVC(3)