GNURLOPT_ALTSVC(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸŽ€ CURLOPT_ALTSVC: set alt-svc cache file name πŸŽ€

okay so bestie, welcome to the GNURLOPT_ALTSVC(3) page from the curl_easy_setopt options crew. We're talking alt-svc cache files, and yes, it's giving very specific libcurl behavior πŸ’…


✨ NAME ✨

CURLOPT_ALTSVC β€” set alt-svc cache file name

🌸 SYNOPSIS 🌸

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ALTSVC, char *filename);

πŸ§ͺ EXPERIMENTAL πŸ§ͺ

Warning, bestie: this feature is early code and is marked as experimental. It can only be enabled by explicitly telling configure with --enable-alt-svc. You are advised to not ship this in production before the experimental label is removed. No cap, that's the actual warning 🫢

πŸ’– DESCRIPTION πŸ’–

You pass in a pointer to a filename, and that tells libcurl to use that file as the Alt-Svc cache. It reads existing cache contents from it, and it may also write it back after a transfer β€” unless CURLALTSVC_READONLYFILE is set in CURLOPT_ALTSVC_CTRL(3).

Specify a blank file name ("") to make libcurl not load from a file at all. Literally blank, bestie 🫧

πŸ¦‹ DEFAULT πŸ¦‹

NULL. The alt-svc cache is not read nor written to file.

🌈 PROTOCOLS 🌈

HTTPS

πŸ“ EXAMPLE πŸ“

CURL *curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_ALTSVC_CTRL, CURLALTSVC_H1);
  curl_easy_setopt(curl, CURLOPT_ALTSVC, "altsvc-cache.txt");
  curl_easy_perform(curl);
}

⭐ AVAILABILITY ⭐

Added in 7.64.1

πŸ’œ RETURN VALUE πŸ’œ

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. Simple as that ✨

πŸ‘‘ SEE ALSO πŸ‘‘


k bye bestie β€” this page is from libcurl 7.64.1, dated 5 Feb 2019, and it's literally the GNURLOPT_ALTSVC(3) manual page πŸ’…βœ¨

πŸ“¦ where this page comes from