1*6236dae4SAndroid Build Coastguard Worker--- 2*6236dae4SAndroid Build Coastguard Workerc: Copyright (C) Daniel Stenberg, <[email protected]>, et al. 3*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl 4*6236dae4SAndroid Build Coastguard WorkerTitle: curl_global_trace 5*6236dae4SAndroid Build Coastguard WorkerSection: 3 6*6236dae4SAndroid Build Coastguard WorkerSource: libcurl 7*6236dae4SAndroid Build Coastguard WorkerSee-also: 8*6236dae4SAndroid Build Coastguard Worker - curl_global_init (3) 9*6236dae4SAndroid Build Coastguard Worker - libcurl (3) 10*6236dae4SAndroid Build Coastguard WorkerProtocol: 11*6236dae4SAndroid Build Coastguard Worker - All 12*6236dae4SAndroid Build Coastguard WorkerAdded-in: 8.3 13*6236dae4SAndroid Build Coastguard Worker--- 14*6236dae4SAndroid Build Coastguard Worker 15*6236dae4SAndroid Build Coastguard Worker# NAME 16*6236dae4SAndroid Build Coastguard Worker 17*6236dae4SAndroid Build Coastguard Workercurl_global_trace - log configuration 18*6236dae4SAndroid Build Coastguard Worker 19*6236dae4SAndroid Build Coastguard Worker# SYNOPSIS 20*6236dae4SAndroid Build Coastguard Worker 21*6236dae4SAndroid Build Coastguard Worker~~~c 22*6236dae4SAndroid Build Coastguard Worker#include <curl/curl.h> 23*6236dae4SAndroid Build Coastguard Worker 24*6236dae4SAndroid Build Coastguard WorkerCURLcode curl_global_trace(const char *config); 25*6236dae4SAndroid Build Coastguard Worker~~~ 26*6236dae4SAndroid Build Coastguard Worker 27*6236dae4SAndroid Build Coastguard Worker# DESCRIPTION 28*6236dae4SAndroid Build Coastguard Worker 29*6236dae4SAndroid Build Coastguard WorkerThis function configures the logging behavior to make some parts of curl more 30*6236dae4SAndroid Build Coastguard Workerverbose or silent than others. 31*6236dae4SAndroid Build Coastguard Worker 32*6236dae4SAndroid Build Coastguard WorkerThis function may be called during the initialization phase of a program. It 33*6236dae4SAndroid Build Coastguard Workerdoes not have to be. It can be called several times even, possibly overwriting 34*6236dae4SAndroid Build Coastguard Workersettings of previous calls. 35*6236dae4SAndroid Build Coastguard Worker 36*6236dae4SAndroid Build Coastguard WorkerCalling this function after transfers have been started is undefined. On some 37*6236dae4SAndroid Build Coastguard Workerplatforms/architectures it might take effect, on others not. 38*6236dae4SAndroid Build Coastguard Worker 39*6236dae4SAndroid Build Coastguard WorkerThis function is thread-safe since libcurl 8.3.0 if curl_version_info(3) has 40*6236dae4SAndroid Build Coastguard Workerthe CURL_VERSION_THREADSAFE feature bit set (most platforms). 41*6236dae4SAndroid Build Coastguard Worker 42*6236dae4SAndroid Build Coastguard WorkerIf this is not thread-safe, you must not call this function when any other 43*6236dae4SAndroid Build Coastguard Workerthread in the program (i.e. a thread sharing the same memory) is running. This 44*6236dae4SAndroid Build Coastguard Workerdoes not just mean no other thread that is using libcurl. Because 45*6236dae4SAndroid Build Coastguard Workercurl_global_init(3) may call functions of other libraries that are similarly 46*6236dae4SAndroid Build Coastguard Workerthread unsafe, it could conflict with any other thread that uses these other 47*6236dae4SAndroid Build Coastguard Workerlibraries. 48*6236dae4SAndroid Build Coastguard Worker 49*6236dae4SAndroid Build Coastguard WorkerIf you are initializing libcurl from a Windows DLL you should not initialize 50*6236dae4SAndroid Build Coastguard Workerit from *DllMain* or a static initializer because Windows holds the loader 51*6236dae4SAndroid Build Coastguard Workerlock during that time and it could cause a deadlock. 52*6236dae4SAndroid Build Coastguard Worker 53*6236dae4SAndroid Build Coastguard WorkerThe *config* string is a list of comma-separated component names. Names are 54*6236dae4SAndroid Build Coastguard Workercase-insensitive and unknown names are ignored. The special name "all" applies 55*6236dae4SAndroid Build Coastguard Workerto all components. Names may be prefixed with '+' or '-' to enable or disable 56*6236dae4SAndroid Build Coastguard Workerdetailed logging for a component. 57*6236dae4SAndroid Build Coastguard Worker 58*6236dae4SAndroid Build Coastguard WorkerThe list of component names is not part of curl's public API. Names may be 59*6236dae4SAndroid Build Coastguard Workeradded or disappear in future versions of libcurl. Since unknown names are 60*6236dae4SAndroid Build Coastguard Workersilently ignored, outdated log configurations does not cause errors when 61*6236dae4SAndroid Build Coastguard Workerupgrading libcurl. Given that, some names can be expected to be fairly stable 62*6236dae4SAndroid Build Coastguard Workerand are listed below for easy reference. 63*6236dae4SAndroid Build Coastguard Worker 64*6236dae4SAndroid Build Coastguard WorkerNote that log configuration applies only to transfers where debug logging is 65*6236dae4SAndroid Build Coastguard Workerenabled. See CURLOPT_VERBOSE(3) or CURLOPT_DEBUGFUNCTION(3) on how to control 66*6236dae4SAndroid Build Coastguard Workerthat. 67*6236dae4SAndroid Build Coastguard Worker 68*6236dae4SAndroid Build Coastguard Worker# TRACE COMPONENTS 69*6236dae4SAndroid Build Coastguard Worker 70*6236dae4SAndroid Build Coastguard Worker## `tcp` 71*6236dae4SAndroid Build Coastguard Worker 72*6236dae4SAndroid Build Coastguard WorkerTracing of TCP socket handling: connect, sends, receives. 73*6236dae4SAndroid Build Coastguard Worker 74*6236dae4SAndroid Build Coastguard Worker## `ssl` 75*6236dae4SAndroid Build Coastguard Worker 76*6236dae4SAndroid Build Coastguard WorkerTracing of SSL/TLS operations, whichever SSL backend is used in your build. 77*6236dae4SAndroid Build Coastguard Worker 78*6236dae4SAndroid Build Coastguard Worker## `ftp` 79*6236dae4SAndroid Build Coastguard Worker 80*6236dae4SAndroid Build Coastguard WorkerTracing of FTP operations when this protocol is enabled in your build. 81*6236dae4SAndroid Build Coastguard Worker 82*6236dae4SAndroid Build Coastguard Worker## `http/2` 83*6236dae4SAndroid Build Coastguard Worker 84*6236dae4SAndroid Build Coastguard WorkerDetails about HTTP/2 handling: frames, events, I/O, etc. 85*6236dae4SAndroid Build Coastguard Worker 86*6236dae4SAndroid Build Coastguard Worker## `http/3` 87*6236dae4SAndroid Build Coastguard Worker 88*6236dae4SAndroid Build Coastguard WorkerDetails about HTTP/3 handling: connect, frames, events, I/O etc. 89*6236dae4SAndroid Build Coastguard Worker 90*6236dae4SAndroid Build Coastguard Worker## `http-proxy` 91*6236dae4SAndroid Build Coastguard Worker 92*6236dae4SAndroid Build Coastguard WorkerInvolved when transfers are tunneled through an HTTP proxy. "h1-proxy" or 93*6236dae4SAndroid Build Coastguard Worker"h2-proxy" are also involved, depending on the HTTP version negotiated with 94*6236dae4SAndroid Build Coastguard Workerthe proxy. 95*6236dae4SAndroid Build Coastguard Worker 96*6236dae4SAndroid Build Coastguard WorkerIn order to find out all components involved in a transfer, run it with "all" 97*6236dae4SAndroid Build Coastguard Workerconfigured. You can then see all names involved in your libcurl version in the 98*6236dae4SAndroid Build Coastguard Workertrace. 99*6236dae4SAndroid Build Coastguard Worker 100*6236dae4SAndroid Build Coastguard Worker## `doh` 101*6236dae4SAndroid Build Coastguard Worker 102*6236dae4SAndroid Build Coastguard WorkerTracing of DNS-over-HTTP operations to resolve hostnames. 103*6236dae4SAndroid Build Coastguard Worker 104*6236dae4SAndroid Build Coastguard Worker## `read` 105*6236dae4SAndroid Build Coastguard Worker 106*6236dae4SAndroid Build Coastguard WorkerTraces reading of upload data from the application in order to send it to the server. 107*6236dae4SAndroid Build Coastguard Worker 108*6236dae4SAndroid Build Coastguard Worker## `smtp` 109*6236dae4SAndroid Build Coastguard Worker 110*6236dae4SAndroid Build Coastguard WorkerTracing of SMTP operations when this protocol is enabled in your build. 111*6236dae4SAndroid Build Coastguard Worker 112*6236dae4SAndroid Build Coastguard Worker## `write` 113*6236dae4SAndroid Build Coastguard Worker 114*6236dae4SAndroid Build Coastguard WorkerTraces writing of download data, received from the server, to the application. 115*6236dae4SAndroid Build Coastguard Worker 116*6236dae4SAndroid Build Coastguard Worker## `ws` 117*6236dae4SAndroid Build Coastguard Worker 118*6236dae4SAndroid Build Coastguard WorkerTracing of WebSocket operations when this protocol is enabled in your build. 119*6236dae4SAndroid Build Coastguard Worker 120*6236dae4SAndroid Build Coastguard Worker# TRACE GROUPS 121*6236dae4SAndroid Build Coastguard Worker 122*6236dae4SAndroid Build Coastguard WorkerBesides the specific component names there are the following group names 123*6236dae4SAndroid Build Coastguard Workerdefined: 124*6236dae4SAndroid Build Coastguard Worker 125*6236dae4SAndroid Build Coastguard Worker## `all` 126*6236dae4SAndroid Build Coastguard Worker 127*6236dae4SAndroid Build Coastguard Worker## `network` 128*6236dae4SAndroid Build Coastguard Worker 129*6236dae4SAndroid Build Coastguard WorkerAll components involved in bare network I/O, including the SSL layer. 130*6236dae4SAndroid Build Coastguard Worker 131*6236dae4SAndroid Build Coastguard WorkerAll components that your libcurl is built with. 132*6236dae4SAndroid Build Coastguard Worker 133*6236dae4SAndroid Build Coastguard Worker## `protocol` 134*6236dae4SAndroid Build Coastguard Worker 135*6236dae4SAndroid Build Coastguard WorkerAll components involved in transfer protocols, such as 'ftp' and 'http/2'. 136*6236dae4SAndroid Build Coastguard Worker 137*6236dae4SAndroid Build Coastguard Worker## `proxy` 138*6236dae4SAndroid Build Coastguard Worker 139*6236dae4SAndroid Build Coastguard WorkerAll components involved in use of proxies. 140*6236dae4SAndroid Build Coastguard Worker 141*6236dae4SAndroid Build Coastguard Worker# %PROTOCOLS% 142*6236dae4SAndroid Build Coastguard Worker 143*6236dae4SAndroid Build Coastguard Worker# EXAMPLE 144*6236dae4SAndroid Build Coastguard Worker 145*6236dae4SAndroid Build Coastguard Worker~~~c 146*6236dae4SAndroid Build Coastguard Workerint main(void) 147*6236dae4SAndroid Build Coastguard Worker{ 148*6236dae4SAndroid Build Coastguard Worker /* log details of HTTP/2 and SSL handling */ 149*6236dae4SAndroid Build Coastguard Worker curl_global_trace("http/2,ssl"); 150*6236dae4SAndroid Build Coastguard Worker 151*6236dae4SAndroid Build Coastguard Worker /* log all details, except SSL handling */ 152*6236dae4SAndroid Build Coastguard Worker curl_global_trace("all,-ssl"); 153*6236dae4SAndroid Build Coastguard Worker} 154*6236dae4SAndroid Build Coastguard Worker~~~ 155*6236dae4SAndroid Build Coastguard Worker 156*6236dae4SAndroid Build Coastguard WorkerBelow is a trace sample where "http/2" was configured. The trace output 157*6236dae4SAndroid Build Coastguard Workerof an enabled component appears at the beginning in brackets. 158*6236dae4SAndroid Build Coastguard Worker~~~ 159*6236dae4SAndroid Build Coastguard Worker* [HTTP/2] [h2sid=1] cf_send(len=96) submit https://example.com/ 160*6236dae4SAndroid Build Coastguard Worker... 161*6236dae4SAndroid Build Coastguard Worker* [HTTP/2] [h2sid=1] FRAME[HEADERS] 162*6236dae4SAndroid Build Coastguard Worker* [HTTP/2] [h2sid=1] 249 header bytes 163*6236dae4SAndroid Build Coastguard Worker... 164*6236dae4SAndroid Build Coastguard Worker~~~ 165*6236dae4SAndroid Build Coastguard Worker 166*6236dae4SAndroid Build Coastguard Worker# %AVAILABILITY% 167*6236dae4SAndroid Build Coastguard Worker 168*6236dae4SAndroid Build Coastguard Worker# RETURN VALUE 169*6236dae4SAndroid Build Coastguard Worker 170*6236dae4SAndroid Build Coastguard WorkerIf this function returns non-zero, something went wrong and the configuration 171*6236dae4SAndroid Build Coastguard Workermay not have any effects or may only been applied partially. 172