Artifactspublic-v0

curl

master
ply4 git calls151 ms288 KiB2 cachedprotocol v2
136 lines3.0 KiBRaw

NAME

CURLOPT_ALTSVC - alt-svc cache filename

SYNOPSIS

c
#include <curl/curl.h>

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

DESCRIPTION

Pass in a pointer to a filename to instruct libcurl to use that file as the Alt-Svc cache to read existing cache contents from and possibly also write it back to after a transfer, unless CURLALTSVC_READONLYFILE is set in CURLOPT_ALTSVC_CTRL(3).

Specify a blank filename ("") to make libcurl not load from a file at all.

The application does not have to keep the string around after setting this option.

Using this option multiple times makes the last set string override the previous ones. Set it to NULL to disable its use again.

SECURITY CONCERNS

libcurl cannot fully protect against attacks where an attacker has write access to the same directory where it is directed to save files. This is particularly sensitive if you save files using elevated privileges.

libcurl creates the file to store the alt-svc cache in using default file permissions, meaning that on *nix systems you may need to restrict your umask to prevent other users on the same system to access the file.

DEFAULT

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

%PROTOCOLS%

EXAMPLE

c
int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_ALTSVC_CTRL, CURLALTSVC_H1);
    curl_easy_setopt(curl, CURLOPT_ALTSVC, "altsvc-cache.txt");
    result = curl_easy_perform(curl);
    curl_easy_cleanup(curl);
  }
}

HISTORY

CURLALTSVC_* macros became long types in 8.16.0, prior to this version a long cast was necessary when passed to curl_easy_setopt(3).

FILE FORMAT

A text based file with one line per alt-svc entry and each line consists of nine space-separated fields.

An example line could look like

h2 www.example.com 8443 h3 second.example.com 443 "20190808 06:18:37" 1 0

The fields of that line are:

h2

ALPN id for the source origin

www.example.comp

Hostname for the source origin

8443

Port number for the source origin

h3

ALPN id for the destination host

second.example.com

Hostname for the destination host

443

Port number for the destination host

2019*

Expiration date and time of this entry within double quotes. The date format is "YYYYMMDD HH:MM:SS" and the time zone is GMT.

1

Boolean (1 or 0) if "persist" was set for this entry

0

Integer priority value (not currently used)

%AVAILABILITY%

RETURN VALUE

curl_easy_setopt(3) returns a CURLcode indicating success or error.

CURLE_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors(3).

1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_ALTSVC
5Section: 3
6Source: libcurl
7See-also:
8 - CURLOPT_ALTSVC_CTRL (3)
9 - CURLOPT_CONNECT_TO (3)
10 - CURLOPT_COOKIEFILE (3)
11 - CURLOPT_RESOLVE (3)
12Protocol:
13 - HTTP
14Added-in: 7.64.1
15---
16<!-- markdown-link-check-disable -->
17# NAME
19CURLOPT_ALTSVC - alt-svc cache filename
21# SYNOPSIS
23~~~c
24#include <curl/curl.h>
26CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ALTSVC, char *filename);
27~~~
29# DESCRIPTION
31Pass in a pointer to a *filename* to instruct libcurl to use that file as
32the Alt-Svc cache to read existing cache contents from and possibly also write
33it back to after a transfer, unless **CURLALTSVC_READONLYFILE** is set in
34CURLOPT_ALTSVC_CTRL(3).
36Specify a blank filename ("") to make libcurl not load from a file at all.
38The application does not have to keep the string around after setting this
39option.
41Using this option multiple times makes the last set string override the
42previous ones. Set it to NULL to disable its use again.
44# SECURITY CONCERNS
46libcurl cannot fully protect against attacks where an attacker has write
47access to the same directory where it is directed to save files. This is
48particularly sensitive if you save files using elevated privileges.
50libcurl creates the file to store the alt-svc cache in using default file
51permissions, meaning that on *nix systems you may need to restrict your umask
52to prevent other users on the same system to access the file.
54# DEFAULT
56NULL. The alt-svc cache is not read nor written to file.
58# %PROTOCOLS%
60# EXAMPLE
62~~~c
63int main(void)
65 CURL *curl = curl_easy_init();
66 if(curl) {
67 CURLcode result;
68 curl_easy_setopt(curl, CURLOPT_ALTSVC_CTRL, CURLALTSVC_H1);
69 curl_easy_setopt(curl, CURLOPT_ALTSVC, "altsvc-cache.txt");
70 result = curl_easy_perform(curl);
71 curl_easy_cleanup(curl);
72 }
74~~~
76# HISTORY
78**CURLALTSVC_*** macros became `long` types in 8.16.0, prior to this version
79a `long` cast was necessary when passed to curl_easy_setopt(3).
81# FILE FORMAT
83A text based file with one line per alt-svc entry and each line consists of
84nine space-separated fields.
86An example line could look like
88 h2 www.example.com 8443 h3 second.example.com 443 "20190808 06:18:37" 1 0
90The fields of that line are:
92## h2
94ALPN id for the source origin
96## www.example.comp
98Hostname for the source origin
100## 8443
102Port number for the source origin
104## h3
106ALPN id for the destination host
108## second.example.com
110Hostname for the destination host
112## 443
114Port number for the destination host
116## 2019*
118Expiration date and time of this entry within double quotes. The date format
119is "YYYYMMDD HH:MM:SS" and the time zone is GMT.
121## 1
123Boolean (1 or 0) if "persist" was set for this entry
125## 0
127Integer priority value (not currently used)
129# %AVAILABILITY%
131# RETURN VALUE
133curl_easy_setopt(3) returns a CURLcode indicating success or error.
135CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
136libcurl-errors(3).
Diagnostics4 git calls · 151 ms
CallStatusSizeTime0151 ms
discover200152 B5 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=5
git.response.bytes=152
git.server.agent=gitty/1.0
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch object-format
git.server.fetch=shallow filter sideband-all
git.protocol.version=2
git.pkt.frames=8
git.pkt.data=6
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=152
git.pkt.payload.max=34
ls-refs200149 B · hit7 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=7
git.response.bytes=149
git.response.cache=HIT
git.response.duration_ms=7
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=149
git.pkt.payload.max=78
git.ls_refs.count=2
git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit7 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=7
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=7
git.fetch.filter=blob:none
git.fetch.filter.requested=tree:0
git.fetch.filter.fallback=blob:none
git.fetch.filter.learned=false
git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=10
git.pkt.data=8
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=293470
git.pkt.payload.max=65516
git.sideband.band1.bytes=293354
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=87
git.pack.bytes=293354
git.pack.ofs_delta=0
git.pack.ref_delta=1
git.pack.chain.max=1
git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0
git.pack.full=86
Open pack map
fetch2001.6 KiB137 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=137
git.response.bytes=1631
git.response.cache=MISS
git.response.duration_ms=137
git.fetch.wants=c4058a4039ce468bcbb2e2874ae36a725fd21bdd
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=1631
git.pkt.payload.max=1610
git.sideband.band1.bytes=1609
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
Ref
refs/heads/master
Commit
31c911efe5652725e930f4d2e60c9060e5f6646d
cf-ray
a5e31d83ac8d8682
Request
f821bd2d…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format