Artifactspublic-v0

curl

master
ply4 git calls111 ms289 KiB2 cachedprotocol v2
213 lines5.5 KiBRaw

NAME

curl_global_trace - log configuration

SYNOPSIS

c
#include <curl/curl.h>

CURLcode curl_global_trace(const char *config);

DESCRIPTION

This function configures the logging behavior to make some parts of curl more verbose or silent than others.

This function may be called during the initialization phase of a program. It does not have to be. It can be called several times even, possibly overwriting settings of previous calls.

Calling this function after transfers have been started is undefined. On some platforms/architectures it might take effect, on others not.

This function is thread-safe since libcurl 8.3.0 if curl_version_info(3) has the CURL_VERSION_THREADSAFE feature bit set (most platforms).

If this is not thread-safe, you must not call this function when any other thread in the program (i.e. a thread sharing the same memory) is running. This does not only mean no other thread that is using libcurl. Because curl_global_init(3) may call functions of other libraries that are similarly thread-unsafe, it could conflict with any other thread that uses these other libraries.

If you are initializing libcurl from a Windows DLL you should not initialize it from DllMain or a static initializer because Windows holds the loader lock during that time and it could cause a deadlock.

The config string is a list of comma-separated component names. Names are case-insensitive and unknown names are ignored. The special name "all" applies to all components. Names may be prefixed with '+' or '-' to enable or disable detailed logging for a component.

The list of component names is not part of curl's public API. Names may be added or disappear in future versions of libcurl. Since unknown names are silently ignored, outdated log configurations does not cause errors when upgrading libcurl. Given that, some names can be expected to be fairly stable and are listed below for easy reference.

Note that log configuration applies only to transfers where debug logging is enabled. See CURLOPT_VERBOSE(3) or CURLOPT_DEBUGFUNCTION(3) on how to control that.

TRACE COMPONENTS

tcp

Tracing of TCP socket handling: connect, sends, receives.

ssl

Tracing of SSL/TLS operations, whichever SSL backend is used in your build.

ftp

Tracing of FTP operations when this protocol is enabled in your build.

http/2

Details about HTTP/2 handling: frames, events, I/O, etc.

http/3

Details about HTTP/3 handling: connect, frames, events, I/O etc.

http-proxy

Involved when transfers are tunneled through an HTTP proxy. "h1-proxy" or "h2-proxy" are also involved, depending on the HTTP version negotiated with the proxy.

In order to find out all components involved in a transfer, run it with "all" configured. You can then see all names involved in your libcurl version in the trace.

dns

Tracing of DNS operations to resolve hostnames and HTTPS records.

doh

Tracing of DoH operations (DNS over HTTPS) to resolve hostnames and HTTPS records.

lib-ids

Adds transfer and connection identifiers as prefix to every call to CURLOPT_DEBUGFUNCTION(3). The format is [n-m] where n is the identifier of the transfer and m is the identifier of the connection. A literal x is used for internal transfers or when no connection is assigned.

For example, [5-x] is the prefix for transfer 5 that has no connection. The command line tool curluses the same format for its --trace-ids option.

lib-ids is intended for libcurl applications that handle multiple transfers but have no own way to identify in trace output which transfer a trace event is connected to.

multi

Traces multi operations managing transfers' state changes and sockets poll states.

read

Traces reading of upload data from the application in order to send it to the server.

ssh

Tracing of SSH related protocols SCP and SFTP.

ssls

Tracing of SSL Session handling, e.g. caching/import/export.

smtp

Tracing of SMTP operations when this protocol is enabled in your build.

threads

Tracing of thread queue and pools, used in threaded DNS resolving.

timer

Tracing of timers set for transfers.

write

Traces writing of download data, received from the server, to the application.

ws

Tracing of WebSocket operations when this protocol is enabled in your build.

TRACE GROUPS

Besides the specific component names there are the following group names defined:

all

network

All components involved in bare network I/O, including the SSL layer.

All components that your libcurl is built with.

protocol

All components involved in transfer protocols, such as 'ftp' and 'http/2'.

proxy

All components involved in use of proxies.

%PROTOCOLS%

EXAMPLE

c
int main(void)
{
  /* log details of HTTP/2 and SSL handling */
  curl_global_trace("http/2,ssl");

  /* log all details, except SSL handling */
  curl_global_trace("all,-ssl");
}

Below is a trace sample where "http/2" was configured. The trace output of an enabled component appears at the beginning in brackets.

* [HTTP/2] [h2sid=1] cf_send(len=96) submit https://example.com/
...
* [HTTP/2] [h2sid=1] FRAME[HEADERS]
* [HTTP/2] [h2sid=1] 249 header bytes
...

%AVAILABILITY%

RETURN VALUE

If this function returns non-zero, something went wrong and the configuration may not have any effects or may only been applied partially.

1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: curl_global_trace
5Section: 3
6Source: libcurl
7See-also:
8 - curl_global_init (3)
9 - libcurl (3)
10Protocol:
11 - All
12Added-in: 8.3.0
13---
15# NAME
17curl_global_trace - log configuration
19# SYNOPSIS
21~~~c
22#include <curl/curl.h>
24CURLcode curl_global_trace(const char *config);
25~~~
27# DESCRIPTION
29This function configures the logging behavior to make some parts of curl more
30verbose or silent than others.
32This function may be called during the initialization phase of a program. It
33does not have to be. It can be called several times even, possibly overwriting
34settings of previous calls.
36Calling this function after transfers have been started is undefined. On some
37platforms/architectures it might take effect, on others not.
39This function is thread-safe since libcurl 8.3.0 if curl_version_info(3) has
40the CURL_VERSION_THREADSAFE feature bit set (most platforms).
42If this is not thread-safe, you must not call this function when any other
43thread in the program (i.e. a thread sharing the same memory) is running. This
44does not only mean no other thread that is using libcurl. Because
45curl_global_init(3) may call functions of other libraries that are similarly
46thread-unsafe, it could conflict with any other thread that uses these other
47libraries.
49If you are initializing libcurl from a Windows DLL you should not initialize
50it from *DllMain* or a static initializer because Windows holds the loader
51lock during that time and it could cause a deadlock.
53The *config* string is a list of comma-separated component names. Names are
54case-insensitive and unknown names are ignored. The special name "all" applies
55to all components. Names may be prefixed with '+' or '-' to enable or disable
56detailed logging for a component.
58The list of component names is not part of curl's public API. Names may be
59added or disappear in future versions of libcurl. Since unknown names are
60silently ignored, outdated log configurations does not cause errors when
61upgrading libcurl. Given that, some names can be expected to be fairly stable
62and are listed below for easy reference.
64Note that log configuration applies only to transfers where debug logging is
65enabled. See CURLOPT_VERBOSE(3) or CURLOPT_DEBUGFUNCTION(3) on how to control
66that.
68# TRACE COMPONENTS
70## `tcp`
72Tracing of TCP socket handling: connect, sends, receives.
74## `ssl`
76Tracing of SSL/TLS operations, whichever SSL backend is used in your build.
78## `ftp`
80Tracing of FTP operations when this protocol is enabled in your build.
82## `http/2`
84Details about HTTP/2 handling: frames, events, I/O, etc.
86## `http/3`
88Details about HTTP/3 handling: connect, frames, events, I/O etc.
90## `http-proxy`
92Involved when transfers are tunneled through an HTTP proxy. "h1-proxy" or
93"h2-proxy" are also involved, depending on the HTTP version negotiated with
94the proxy.
96In order to find out all components involved in a transfer, run it with "all"
97configured. You can then see all names involved in your libcurl version in the
98trace.
100## `dns`
102Tracing of DNS operations to resolve hostnames and HTTPS records.
104## `doh`
106Tracing of DoH operations (DNS over HTTPS) to resolve hostnames and
107HTTPS records.
109## `lib-ids`
111Adds transfer and connection identifiers as prefix to every call to
112CURLOPT_DEBUGFUNCTION(3). The format is `[n-m]` where `n` is the identifier
113of the transfer and `m` is the identifier of the connection. A literal `x`
114is used for internal transfers or when no connection is assigned.
116For example, `[5-x]` is the prefix for transfer 5 that has no
117connection. The command line tool `curl`uses the same format for its
118`--trace-ids` option.
120`lib-ids` is intended for libcurl applications that handle multiple
121transfers but have no own way to identify in trace output which transfer
122a trace event is connected to.
124## `multi`
126Traces multi operations managing transfers' state changes and sockets poll
127states.
129## `read`
131Traces reading of upload data from the application in order to send it to the
132server.
134## `ssh`
136Tracing of SSH related protocols SCP and SFTP.
138## `ssls`
140Tracing of SSL Session handling, e.g. caching/import/export.
142## `smtp`
144Tracing of SMTP operations when this protocol is enabled in your build.
146## `threads`
148Tracing of thread queue and pools, used in threaded DNS resolving.
150## `timer`
152Tracing of timers set for transfers.
154## `write`
156Traces writing of download data, received from the server, to the application.
158## `ws`
160Tracing of WebSocket operations when this protocol is enabled in your build.
162# TRACE GROUPS
164Besides the specific component names there are the following group names
165defined:
167## `all`
169## `network`
171All components involved in bare network I/O, including the SSL layer.
173All components that your libcurl is built with.
175## `protocol`
177All components involved in transfer protocols, such as 'ftp' and 'http/2'.
179## `proxy`
181All components involved in use of proxies.
183# %PROTOCOLS%
185# EXAMPLE
187~~~c
188int main(void)
190 /* log details of HTTP/2 and SSL handling */
191 curl_global_trace("http/2,ssl");
193 /* log all details, except SSL handling */
194 curl_global_trace("all,-ssl");
196~~~
198Below is a trace sample where "http/2" was configured. The trace output
199of an enabled component appears at the beginning in brackets.
200~~~
201* [HTTP/2] [h2sid=1] cf_send(len=96) submit https://example.com/
202...
203* [HTTP/2] [h2sid=1] FRAME[HEADERS]
204* [HTTP/2] [h2sid=1] 249 header bytes
205...
206~~~
208# %AVAILABILITY%
210# RETURN VALUE
212If this function returns non-zero, something went wrong and the configuration
213may not have any effects or may only been applied partially.
Diagnostics4 git calls · 111 ms
CallStatusSizeTime0111 ms
discover200152 B3 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=3
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 · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=3
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
fetch2002.6 KiB105 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=105
git.response.bytes=2633
git.response.cache=MISS
git.response.duration_ms=105
git.fetch.wants=e4cf8e05a56427ccca4de33530e51385e8a7ee7d
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=2633
git.pkt.payload.max=2612
git.sideband.band1.bytes=2611
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
a5e3411eea70be76
Request
55f5c86a…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format