Artifactspublic-v0

curl

master
ply4 git calls133 ms289 KiB2 cachedprotocol v2
133 lines3.7 KiBRaw

NAME

CURLOPT_RESOLVE - provide custom hostname to IP address resolves

SYNOPSIS

c
#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RESOLVE,
                          struct curl_slist *hosts);

DESCRIPTION

Pass a pointer to a linked list of strings with hostname resolve information to use for requests with this handle. The linked list should be a fully valid list of struct curl_slist structs properly filled in. Use curl_slist_append(3) to create the list and curl_slist_free_all(3) to clean up an entire list.

libcurl does not copy the list, it needs to be kept around until after the transfer has completed.

Each resolve rule to add should be written using the format

[+]HOST:PORT:ADDRESS[,ADDRESS]

HOST is the name libcurl wants to resolve, PORT is the port number of the service where libcurl wants to connect to the HOST and ADDRESS is one or more numerical IP addresses. If you specify multiple IP addresses they need to be separated by comma. If libcurl is built to support IPv6, each of the ADDRESS entries can of course be either IPv4 or IPv6 style addressing.

Specify the host as a single asterisk (*) to match all names. This wildcard is resolved last so any resolve with a specific host and port number is given priority.

This option effectively populates the DNS cache with entries for the host+port pair so redirects and everything that operations against the HOST+PORT instead use your provided ADDRESS.

The optional leading plus (+) specifies that the new entry should timeout. Entries added without the leading plus character never times out whereas entries added with +HOST:... times out like ordinary DNS cache entries.

If the DNS cache already has an entry for the given host+port pair, the new entry overrides the former one.

An ADDRESS provided by this option is only used if not restricted by the setting of CURLOPT_IPRESOLVE(3) to a different IP version.

To remove names from the DNS cache again, to stop providing these fake resolves, include a string in the linked list that uses the format

-HOST:PORT

The entry to remove must be prefixed with a dash, and the hostname and port number must exactly match what was added previously.

Provide IPv6 addresses within [brackets].

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

DEFAULT

NULL

%PROTOCOLS%

EXAMPLE

c
int main(void)
{
  CURL *curl;
  struct curl_slist *host = NULL;
  host = curl_slist_append(NULL, "example.com:443:127.0.0.1");
  host = curl_slist_append(host, "example.com:443:[2001:db8::252f:efd6]");

  curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_RESOLVE, host);
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");

    result = curl_easy_perform(curl);

    /* always cleanup */
    curl_easy_cleanup(curl);
  }

  curl_slist_free_all(host);
}

HISTORY

Added in 7.21.3. Removal support added in 7.42.0.

Support for providing the ADDRESS within [brackets] was added in 7.57.0.

Support for providing multiple IP addresses per entry was added in 7.59.0.

Support for adding non-permanent entries by using the "+" prefix was added in 7.75.0.

Support for specifying the host component as an IPv6 address was added in 8.13.0.

%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_RESOLVE
5Section: 3
6Source: libcurl
7See-also:
8 - CURLOPT_CONNECT_TO (3)
9 - CURLOPT_DNS_CACHE_TIMEOUT (3)
10 - CURLOPT_IPRESOLVE (3)
11Protocol:
12 - All
13Added-in: 7.21.3
14---
16# NAME
18CURLOPT_RESOLVE - provide custom hostname to IP address resolves
20# SYNOPSIS
22~~~c
23#include <curl/curl.h>
25CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RESOLVE,
26 struct curl_slist *hosts);
27~~~
29# DESCRIPTION
31Pass a pointer to a linked list of strings with hostname resolve information
32to use for requests with this handle. The linked list should be a fully valid
33list of **struct curl_slist** structs properly filled in. Use
34curl_slist_append(3) to create the list and curl_slist_free_all(3) to clean up
35an entire list.
37libcurl does not copy the list, it needs to be kept around until after the
38transfer has completed.
40Each resolve rule to add should be written using the format
42 [+]HOST:PORT:ADDRESS[,ADDRESS]
44HOST is the name libcurl wants to resolve, PORT is the port number of the
45service where libcurl wants to connect to the HOST and ADDRESS is one or more
46numerical IP addresses. If you specify multiple IP addresses they need to be
47separated by comma. If libcurl is built to support IPv6, each of the ADDRESS
48entries can of course be either IPv4 or IPv6 style addressing.
50Specify the host as a single asterisk (`*`) to match all names. This wildcard
51is resolved last so any resolve with a specific host and port number is given
52priority.
54This option effectively populates the DNS cache with entries for the host+port
55pair so redirects and everything that operations against the HOST+PORT instead
56use your provided ADDRESS.
58The optional leading plus (`+`) specifies that the new entry should timeout.
59Entries added without the leading plus character never times out whereas
60entries added with `+HOST:...` times out like ordinary DNS cache entries.
62If the DNS cache already has an entry for the given host+port pair, the new
63entry overrides the former one.
65An ADDRESS provided by this option is only used if not restricted by the
66setting of CURLOPT_IPRESOLVE(3) to a different IP version.
68To remove names from the DNS cache again, to stop providing these fake
69resolves, include a string in the linked list that uses the format
71 -HOST:PORT
73The entry to remove must be prefixed with a dash, and the hostname and port
74number must exactly match what was added previously.
76Provide IPv6 addresses within [brackets].
78Using this option multiple times makes the last set list override the previous
79ones. Set it to NULL to disable its use again.
81# DEFAULT
83NULL
85# %PROTOCOLS%
87# EXAMPLE
89~~~c
90int main(void)
92 CURL *curl;
93 struct curl_slist *host = NULL;
94 host = curl_slist_append(NULL, "example.com:443:127.0.0.1");
95 host = curl_slist_append(host, "example.com:443:[2001:db8::252f:efd6]");
97 curl = curl_easy_init();
98 if(curl) {
99 CURLcode result;
100 curl_easy_setopt(curl, CURLOPT_RESOLVE, host);
101 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
103 result = curl_easy_perform(curl);
105 /* always cleanup */
106 curl_easy_cleanup(curl);
107 }
109 curl_slist_free_all(host);
111~~~
113# HISTORY
115Added in 7.21.3. Removal support added in 7.42.0.
117Support for providing the ADDRESS within [brackets] was added in 7.57.0.
119Support for providing multiple IP addresses per entry was added in 7.59.0.
121Support for adding non-permanent entries by using the "+" prefix was added in
1227.75.0.
124Support for specifying the host component as an IPv6 address was added in 8.13.0.
126# %AVAILABILITY%
128# RETURN VALUE
130curl_easy_setopt(3) returns a CURLcode indicating success or error.
132CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
133libcurl-errors(3).
Diagnostics4 git calls · 133 ms
CallStatusSizeTime0133 ms
discover200152 B3 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
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 · hit3 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=3
git.response.bytes=149
git.response.cache=HIT
git.response.duration_ms=3
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 · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=128
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=2
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.9 KiB128 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=1907
git.response.cache=MISS
git.response.duration_ms=128
git.fetch.wants=b4152b11afe3dd873b74ef1e8f9650f46fbd2834
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=1907
git.pkt.payload.max=1886
git.sideband.band1.bytes=1885
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
a5e352ec3d0a224d
Request
0d497803…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format