| 1 |
.\" ************************************************************************** |
| 2 |
.\" * _ _ ____ _ |
| 3 |
.\" * Project ___| | | | _ \| | |
| 4 |
.\" * / __| | | | |_) | | |
| 5 |
.\" * | (__| |_| | _ <| |___ |
| 6 |
.\" * \___|\___/|_| \_\_____| |
| 7 |
.\" * |
| 8 |
.\" * Copyright (C) 1998 - 2020, Daniel Stenberg, <[email protected]>, et al. |
| 9 |
.\" * |
| 10 |
.\" * This software is licensed as described in the file COPYING, which |
| 11 |
.\" * you should have received as part of this distribution. The terms |
| 12 |
.\" * are also available at https://curl.haxx.se/docs/copyright.html. |
| 13 |
.\" * |
| 14 |
.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell |
| 15 |
.\" * copies of the Software, and permit persons to whom the Software is |
| 16 |
.\" * furnished to do so, under the terms of the COPYING file. |
| 17 |
.\" * |
| 18 |
.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 19 |
.\" * KIND, either express or implied. |
| 20 |
.\" * |
| 21 |
.\" ************************************************************************** |
| 22 |
.\" |
| 23 |
.TH CURLOPT_ALTSVC_CTRL 3 "5 Feb 2019" "libcurl 7.64.1" "curl_easy_setopt options" |
| 24 |
.SH NAME |
| 25 |
CURLOPT_ALTSVC_CTRL \- control alt-svc behavior |
| 26 |
.SH SYNOPSIS |
| 27 |
.nf |
| 28 |
#include <curl/curl.h> |
| 29 |
|
| 30 |
#define CURLALTSVC_IMMEDIATELY (1<<0) |
| 31 |
#define CURLALTSVC_READONLYFILE (1<<2) |
| 32 |
#define CURLALTSVC_H1 (1<<3) |
| 33 |
#define CURLALTSVC_H2 (1<<4) |
| 34 |
#define CURLALTSVC_H3 (1<<5) |
| 35 |
|
| 36 |
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ALTSVC_CTRL, long bitmask); |
| 37 |
.fi |
| 38 |
.SH EXPERIMENTAL |
| 39 |
Warning: this feature is early code and is marked as experimental. It can only |
| 40 |
be enabled by explicitly telling configure with \fB--enable-alt-svc\fP. You are |
| 41 |
advised to not ship this in production before the experimental label is |
| 42 |
removed. |
| 43 |
.SH DESCRIPTION |
| 44 |
Populate the long \fIbitmask\fP with the correct set of features to instruct |
| 45 |
libcurl how to handle Alt-Svc for the transfers using this handle. |
| 46 |
|
| 47 |
libcurl will only accept Alt-Svc headers over a secure transport, meaning |
| 48 |
HTTPS. It will also only complete a request to an alternative origin if that |
| 49 |
origin is properly hosted over HTTPS. These requirements are there to make |
| 50 |
sure both the source and the destination are legitimate. |
| 51 |
|
| 52 |
Setting any bit will enable the alt-svc engine. |
| 53 |
.IP "CURLALTSVC_IMMEDIATELY" |
| 54 |
If an Alt-Svc: header is received, this instructs libcurl to switch to one of |
| 55 |
those alternatives asap rather than to save it and use for the next |
| 56 |
request. (Not currently supported). |
| 57 |
.IP "CURLALTSVC_READONLYFILE" |
| 58 |
Do not write the alt-svc cache back to the file specified with |
| 59 |
\fICURLOPT_ALTSVC(3)\fP even if it gets updated. By default a file specified |
| 60 |
with that option will be read and written to as deemed necessary. |
| 61 |
.IP "CURLALTSVC_H1" |
| 62 |
Accept alternative services offered over HTTP/1.1. |
| 63 |
.IP "CURLALTSVC_H2" |
| 64 |
Accept alternative services offered over HTTP/2. This will only be used if |
| 65 |
libcurl was also built to actually support HTTP/2, otherwise this bit will be |
| 66 |
ignored. |
| 67 |
.IP "CURLALTSVC_H3" |
| 68 |
Accept alternative services offered over HTTP/3. This will only be used if |
| 69 |
libcurl was also built to actually support HTTP/3, otherwise this bit will be |
| 70 |
ignored. |
| 71 |
.SH DEFAULT |
| 72 |
Alt-Svc handling is disabled by default. If \fICURLOPT_ALTSVC(3)\fP is set, |
| 73 |
\fICURLOPT_ALTSVC_CTRL(3)\fP has a default value corresponding to |
| 74 |
CURLALTSVC_H1 | CURLALTSVC_H2 | CURLALTSVC_H3 - the HTTP/2 and HTTP/3 bits are |
| 75 |
only set if libcurl was built with support for those versions. |
| 76 |
.SH PROTOCOLS |
| 77 |
HTTPS |
| 78 |
.SH EXAMPLE |
| 79 |
.nf |
| 80 |
CURL *curl = curl_easy_init(); |
| 81 |
if(curl) { |
| 82 |
curl_easy_setopt(curl, CURLOPT_ALTSVC_CTRL, CURLALTSVC_H1); |
| 83 |
curl_easy_setopt(curl, CURLOPT_ALTSVC, "altsvc-cache.txt"); |
| 84 |
curl_easy_perform(curl); |
| 85 |
} |
| 86 |
.fi |
| 87 |
.SH AVAILABILITY |
| 88 |
Added in 7.64.1 |
| 89 |
.SH RETURN VALUE |
| 90 |
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. |
| 91 |
.SH "SEE ALSO" |
| 92 |
.BR CURLOPT_ALTSVC "(3), " CURLOPT_CONNECT_TO "(3), " CURLOPT_RESOLVE "(3), " |