2024-01-17 18:32:44 +08:00
|
|
|
---
|
2024-02-28 18:28:10 +08:00
|
|
|
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
2024-01-17 18:32:44 +08:00
|
|
|
SPDX-License-Identifier: curl
|
|
|
|
Title: curl_global_trace
|
|
|
|
Section: 3
|
|
|
|
Source: libcurl
|
|
|
|
See-also:
|
|
|
|
- curl_global_init (3)
|
|
|
|
- libcurl (3)
|
2024-03-21 18:50:20 +08:00
|
|
|
Protocol:
|
2024-03-23 06:48:54 +08:00
|
|
|
- All
|
2024-01-17 18:32:44 +08:00
|
|
|
---
|
|
|
|
|
|
|
|
# NAME
|
|
|
|
|
2024-04-02 21:34:12 +08:00
|
|
|
curl_global_trace - log configuration
|
2024-01-17 18:32:44 +08:00
|
|
|
|
|
|
|
# SYNOPSIS
|
|
|
|
|
|
|
|
~~~c
|
2023-08-03 23:32:25 +08:00
|
|
|
#include <curl/curl.h>
|
|
|
|
|
|
|
|
CURLcode curl_global_trace(const char *config);
|
2024-01-17 18:32:44 +08:00
|
|
|
~~~
|
|
|
|
|
|
|
|
# DESCRIPTION
|
|
|
|
|
2024-04-02 21:34:12 +08:00
|
|
|
This function configures the logging behavior to make some parts of curl more
|
|
|
|
verbose or silent than others.
|
2023-08-03 23:32:25 +08:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2024-04-02 21:34:12 +08:00
|
|
|
Calling this function after transfers have been started is undefined. On some
|
|
|
|
platforms/architectures it might take effect, on others not.
|
2023-08-03 23:32:25 +08:00
|
|
|
|
2024-04-02 21:34:12 +08:00
|
|
|
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).
|
2023-08-03 23:32:25 +08:00
|
|
|
|
|
|
|
If this is not thread-safe, you must not call this function when any other
|
2024-04-02 21:34:12 +08:00
|
|
|
thread in the program (i.e. a thread sharing the same memory) is running. This
|
|
|
|
does not just 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.
|
2023-08-03 23:32:25 +08:00
|
|
|
|
|
|
|
If you are initializing libcurl from a Windows DLL you should not initialize
|
2024-01-17 18:32:44 +08:00
|
|
|
it from *DllMain* or a static initializer because Windows holds the loader
|
2023-08-03 23:32:25 +08:00
|
|
|
lock during that time and it could cause a deadlock.
|
|
|
|
|
2024-04-02 21:34:12 +08:00
|
|
|
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.
|
2023-08-03 23:32:25 +08:00
|
|
|
|
2023-08-22 23:40:39 +08:00
|
|
|
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.
|
2023-08-03 23:32:25 +08:00
|
|
|
|
2024-04-02 21:34:12 +08:00
|
|
|
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.
|
2023-08-03 23:32:25 +08:00
|
|
|
|
2024-01-17 18:32:44 +08:00
|
|
|
# TRACE COMPONENTS
|
|
|
|
|
2024-02-19 17:56:14 +08:00
|
|
|
## `tcp`
|
2024-01-17 18:32:44 +08:00
|
|
|
|
2023-08-03 23:32:25 +08:00
|
|
|
Tracing of TCP socket handling: connect, reads, writes.
|
2024-01-17 18:32:44 +08:00
|
|
|
|
2024-02-19 17:56:14 +08:00
|
|
|
## `ssl`
|
2024-01-17 18:32:44 +08:00
|
|
|
|
2023-08-03 23:32:25 +08:00
|
|
|
Tracing of SSL/TLS operations, whichever SSL backend is used in your build.
|
2024-01-17 18:32:44 +08:00
|
|
|
|
2024-02-19 17:56:14 +08:00
|
|
|
## `http/2`
|
2024-01-17 18:32:44 +08:00
|
|
|
|
2023-08-03 23:32:25 +08:00
|
|
|
Details about HTTP/2 handling: frames, events, I/O, etc.
|
2024-01-17 18:32:44 +08:00
|
|
|
|
2024-02-19 17:56:14 +08:00
|
|
|
## `http/3`
|
2024-01-17 18:32:44 +08:00
|
|
|
|
2023-08-03 23:32:25 +08:00
|
|
|
Details about HTTP/3 handling: connect, frames, events, I/O etc.
|
2024-01-17 18:32:44 +08:00
|
|
|
|
2024-02-19 17:56:14 +08:00
|
|
|
## `http-proxy`
|
2024-01-17 18:32:44 +08:00
|
|
|
|
2024-01-23 22:12:09 +08:00
|
|
|
Involved when transfers are tunneled through an HTTP proxy. "h1-proxy" or
|
2023-08-03 23:32:25 +08:00
|
|
|
"h2-proxy" are also involved, depending on the HTTP version negotiated with
|
|
|
|
the proxy.
|
|
|
|
|
2023-08-22 23:40:39 +08:00
|
|
|
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.
|
2023-08-03 23:32:25 +08:00
|
|
|
|
2023-11-27 18:30:25 +08:00
|
|
|
## `doh`
|
|
|
|
|
|
|
|
Tracing of DNS-over-HTTP operations to resolve hostnames.
|
|
|
|
|
2024-01-17 18:32:44 +08:00
|
|
|
# EXAMPLE
|
|
|
|
|
|
|
|
~~~c
|
2023-12-04 17:50:42 +08:00
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
/* log details of HTTP/2 and SSL handling */
|
|
|
|
curl_global_trace("http/2,ssl");
|
2023-08-03 23:32:25 +08:00
|
|
|
|
2023-12-04 17:50:42 +08:00
|
|
|
/* log all details, except SSL handling */
|
|
|
|
curl_global_trace("all,-ssl");
|
|
|
|
}
|
2024-01-17 18:32:44 +08:00
|
|
|
~~~
|
2023-08-03 23:32:25 +08:00
|
|
|
|
|
|
|
Below is a trace sample where "http/2" was configured. The trace output
|
|
|
|
of an enabled component appears at the beginning in brackets.
|
2024-01-17 18:32:44 +08:00
|
|
|
~~~
|
2023-08-03 23:32:25 +08:00
|
|
|
* [HTTP/2] [h2sid=1] cf_send(len=96) submit https://example.com/
|
2024-01-17 18:32:44 +08:00
|
|
|
...
|
2023-08-03 23:32:25 +08:00
|
|
|
* [HTTP/2] [h2sid=1] FRAME[HEADERS]
|
|
|
|
* [HTTP/2] [h2sid=1] 249 header bytes
|
2024-01-17 18:32:44 +08:00
|
|
|
...
|
|
|
|
~~~
|
|
|
|
|
|
|
|
# AVAILABILITY
|
2023-08-03 23:32:25 +08:00
|
|
|
|
|
|
|
Added in 8.3
|
2024-01-17 18:32:44 +08:00
|
|
|
|
|
|
|
# RETURN VALUE
|
|
|
|
|
2023-08-03 23:32:25 +08:00
|
|
|
If this function returns non-zero, something went wrong and the configuration
|
|
|
|
may not have any effects or may only been applied partially.
|