xref: /aosp_15_r20/external/curl/docs/libcurl/opts/CURLOPT_ALTSVC.md (revision 6236dae45794135f37c4eb022389c904c8b0090d)
1*6236dae4SAndroid Build Coastguard Worker---
2*6236dae4SAndroid Build Coastguard Workerc: Copyright (C) Daniel Stenberg, <[email protected]>, et al.
3*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl
4*6236dae4SAndroid Build Coastguard WorkerTitle: CURLOPT_ALTSVC
5*6236dae4SAndroid Build Coastguard WorkerSection: 3
6*6236dae4SAndroid Build Coastguard WorkerSource: libcurl
7*6236dae4SAndroid Build Coastguard WorkerSee-also:
8*6236dae4SAndroid Build Coastguard Worker  - CURLOPT_ALTSVC_CTRL (3)
9*6236dae4SAndroid Build Coastguard Worker  - CURLOPT_CONNECT_TO (3)
10*6236dae4SAndroid Build Coastguard Worker  - CURLOPT_COOKIEFILE (3)
11*6236dae4SAndroid Build Coastguard Worker  - CURLOPT_RESOLVE (3)
12*6236dae4SAndroid Build Coastguard WorkerProtocol:
13*6236dae4SAndroid Build Coastguard Worker  - HTTP
14*6236dae4SAndroid Build Coastguard WorkerAdded-in: 7.64.1
15*6236dae4SAndroid Build Coastguard Worker---
16*6236dae4SAndroid Build Coastguard Worker<!-- markdown-link-check-disable -->
17*6236dae4SAndroid Build Coastguard Worker# NAME
18*6236dae4SAndroid Build Coastguard Worker
19*6236dae4SAndroid Build Coastguard WorkerCURLOPT_ALTSVC - alt-svc cache filename
20*6236dae4SAndroid Build Coastguard Worker
21*6236dae4SAndroid Build Coastguard Worker# SYNOPSIS
22*6236dae4SAndroid Build Coastguard Worker
23*6236dae4SAndroid Build Coastguard Worker~~~c
24*6236dae4SAndroid Build Coastguard Worker#include <curl/curl.h>
25*6236dae4SAndroid Build Coastguard Worker
26*6236dae4SAndroid Build Coastguard WorkerCURLcode curl_easy_setopt(CURL *handle, CURLOPT_ALTSVC, char *filename);
27*6236dae4SAndroid Build Coastguard Worker~~~
28*6236dae4SAndroid Build Coastguard Worker
29*6236dae4SAndroid Build Coastguard Worker# DESCRIPTION
30*6236dae4SAndroid Build Coastguard Worker
31*6236dae4SAndroid Build Coastguard WorkerPass in a pointer to a *filename* to instruct libcurl to use that file as
32*6236dae4SAndroid Build Coastguard Workerthe Alt-Svc cache to read existing cache contents from and possibly also write
33*6236dae4SAndroid Build Coastguard Workerit back to after a transfer, unless **CURLALTSVC_READONLYFILE** is set in
34*6236dae4SAndroid Build Coastguard WorkerCURLOPT_ALTSVC_CTRL(3).
35*6236dae4SAndroid Build Coastguard Worker
36*6236dae4SAndroid Build Coastguard WorkerSpecify a blank filename ("") to make libcurl not load from a file at all.
37*6236dae4SAndroid Build Coastguard Worker
38*6236dae4SAndroid Build Coastguard WorkerThe application does not have to keep the string around after setting this
39*6236dae4SAndroid Build Coastguard Workeroption.
40*6236dae4SAndroid Build Coastguard Worker
41*6236dae4SAndroid Build Coastguard WorkerUsing this option multiple times makes the last set string override the
42*6236dae4SAndroid Build Coastguard Workerprevious ones. Set it to NULL to disable its use again.
43*6236dae4SAndroid Build Coastguard Worker
44*6236dae4SAndroid Build Coastguard Worker# DEFAULT
45*6236dae4SAndroid Build Coastguard Worker
46*6236dae4SAndroid Build Coastguard WorkerNULL. The alt-svc cache is not read nor written to file.
47*6236dae4SAndroid Build Coastguard Worker
48*6236dae4SAndroid Build Coastguard Worker# %PROTOCOLS%
49*6236dae4SAndroid Build Coastguard Worker
50*6236dae4SAndroid Build Coastguard Worker# EXAMPLE
51*6236dae4SAndroid Build Coastguard Worker
52*6236dae4SAndroid Build Coastguard Worker~~~c
53*6236dae4SAndroid Build Coastguard Workerint main(void)
54*6236dae4SAndroid Build Coastguard Worker{
55*6236dae4SAndroid Build Coastguard Worker  CURL *curl = curl_easy_init();
56*6236dae4SAndroid Build Coastguard Worker  if(curl) {
57*6236dae4SAndroid Build Coastguard Worker    curl_easy_setopt(curl, CURLOPT_ALTSVC_CTRL, CURLALTSVC_H1);
58*6236dae4SAndroid Build Coastguard Worker    curl_easy_setopt(curl, CURLOPT_ALTSVC, "altsvc-cache.txt");
59*6236dae4SAndroid Build Coastguard Worker    curl_easy_perform(curl);
60*6236dae4SAndroid Build Coastguard Worker  }
61*6236dae4SAndroid Build Coastguard Worker}
62*6236dae4SAndroid Build Coastguard Worker~~~
63*6236dae4SAndroid Build Coastguard Worker
64*6236dae4SAndroid Build Coastguard Worker# FILE FORMAT
65*6236dae4SAndroid Build Coastguard Worker
66*6236dae4SAndroid Build Coastguard WorkerA text based file with one line per alt-svc entry and each line consists of
67*6236dae4SAndroid Build Coastguard Workernine space-separated fields.
68*6236dae4SAndroid Build Coastguard Worker
69*6236dae4SAndroid Build Coastguard WorkerAn example line could look like
70*6236dae4SAndroid Build Coastguard Worker
71*6236dae4SAndroid Build Coastguard Worker    h2 www.example.com 8443 h3 second.example.com 443 "20190808 06:18:37" 1 0
72*6236dae4SAndroid Build Coastguard Worker
73*6236dae4SAndroid Build Coastguard WorkerThe fields of that line are:
74*6236dae4SAndroid Build Coastguard Worker
75*6236dae4SAndroid Build Coastguard Worker## h2
76*6236dae4SAndroid Build Coastguard Worker
77*6236dae4SAndroid Build Coastguard WorkerALPN id for the source origin
78*6236dae4SAndroid Build Coastguard Worker
79*6236dae4SAndroid Build Coastguard Worker## www.example.comp
80*6236dae4SAndroid Build Coastguard Worker
81*6236dae4SAndroid Build Coastguard WorkerHostname for the source origin
82*6236dae4SAndroid Build Coastguard Worker
83*6236dae4SAndroid Build Coastguard Worker## 8443
84*6236dae4SAndroid Build Coastguard Worker
85*6236dae4SAndroid Build Coastguard WorkerPort number for the source origin
86*6236dae4SAndroid Build Coastguard Worker
87*6236dae4SAndroid Build Coastguard Worker## h3
88*6236dae4SAndroid Build Coastguard Worker
89*6236dae4SAndroid Build Coastguard WorkerALPN id for the destination host
90*6236dae4SAndroid Build Coastguard Worker
91*6236dae4SAndroid Build Coastguard Worker## second.example.com
92*6236dae4SAndroid Build Coastguard Worker
93*6236dae4SAndroid Build Coastguard WorkerHostname for the destination host
94*6236dae4SAndroid Build Coastguard Worker
95*6236dae4SAndroid Build Coastguard Worker## 443
96*6236dae4SAndroid Build Coastguard Worker
97*6236dae4SAndroid Build Coastguard WorkerPort number for the destination host
98*6236dae4SAndroid Build Coastguard Worker
99*6236dae4SAndroid Build Coastguard Worker## 2019*
100*6236dae4SAndroid Build Coastguard Worker
101*6236dae4SAndroid Build Coastguard WorkerExpiration date and time of this entry within double quotes. The date format
102*6236dae4SAndroid Build Coastguard Workeris "YYYYMMDD HH:MM:SS" and the time zone is GMT.
103*6236dae4SAndroid Build Coastguard Worker
104*6236dae4SAndroid Build Coastguard Worker## 1
105*6236dae4SAndroid Build Coastguard Worker
106*6236dae4SAndroid Build Coastguard WorkerBoolean (1 or 0) if "persist" was set for this entry
107*6236dae4SAndroid Build Coastguard Worker
108*6236dae4SAndroid Build Coastguard Worker## 0
109*6236dae4SAndroid Build Coastguard Worker
110*6236dae4SAndroid Build Coastguard WorkerInteger priority value (not currently used)
111*6236dae4SAndroid Build Coastguard Worker
112*6236dae4SAndroid Build Coastguard Worker# %AVAILABILITY%
113*6236dae4SAndroid Build Coastguard Worker
114*6236dae4SAndroid Build Coastguard Worker# RETURN VALUE
115*6236dae4SAndroid Build Coastguard Worker
116*6236dae4SAndroid Build Coastguard WorkerReturns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
117