1curl_easy_getinfo(3)                libcurl               curl_easy_getinfo(3)
2
3
4

NAME

6       curl_easy_getinfo - extract information from a curl handle
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ... );
12

DESCRIPTION

14       Request  internal information from the curl session with this function.
15       The third argument MUST be pointing to the specific type  of  the  used
16       option  which  is  documented  in each man page of the option. The data
17       pointed-to will be filled in accordingly and can be relied upon only if
18       the  function  returns  CURLE_OK.  Use  this function AFTER a performed
19       transfer if you want to get transfer related data.
20
21       You should not free the memory returned by this function unless  it  is
22       explicitly mentioned below.
23

AVAILABLE INFORMATION

25       The following information can be extracted:
26
27       CURLINFO_EFFECTIVE_METHOD
28              Last used HTTP method.  See CURLINFO_EFFECTIVE_METHOD(3)
29
30       CURLINFO_EFFECTIVE_URL
31              Last used URL.  See CURLINFO_EFFECTIVE_URL(3)
32
33       CURLINFO_RESPONSE_CODE
34              Last received response code.  See CURLINFO_RESPONSE_CODE(3)
35
36       CURLINFO_REFERER
37              Referrer header.  See CURLINFO_REFERER(3)
38
39       CURLINFO_HTTP_CONNECTCODE
40              Last  proxy  CONNECT  response code.  See CURLINFO_HTTP_CONNECT‐
41              CODE(3)
42
43       CURLINFO_HTTP_VERSION
44              The http version used in the connection.  See CURLINFO_HTTP_VER‐
45              SION(3)
46
47       CURLINFO_FILETIME
48              Remote time of the retrieved document. See CURLINFO_FILETIME(3)
49
50       CURLINFO_FILETIME_T
51              Remote  time  of  the  retrieved  document.  See  CURLINFO_FILE‐
52              TIME_T(3)
53
54       CURLINFO_TOTAL_TIME
55              Total time of previous transfer.  See CURLINFO_TOTAL_TIME(3)
56
57       CURLINFO_TOTAL_TIME_T
58              Total time of previous transfer.  See CURLINFO_TOTAL_TIME_T(3)
59
60       CURLINFO_NAMELOOKUP_TIME
61              Time  from  start   until   name   resolving   completed.    See
62              CURLINFO_NAMELOOKUP_TIME(3)
63
64       CURLINFO_NAMELOOKUP_TIME_T
65              Time   from   start   until   name   resolving  completed.   See
66              CURLINFO_NAMELOOKUP_TIME_T(3)
67
68       CURLINFO_CONNECT_TIME
69              Time from start until  remote  host  or  proxy  completed.   See
70              CURLINFO_CONNECT_TIME(3)
71
72       CURLINFO_CONNECT_TIME_T
73              Time  from  start  until  remote  host  or proxy completed.  See
74              CURLINFO_CONNECT_TIME_T(3)
75
76       CURLINFO_APPCONNECT_TIME
77              Time  from  start  until  SSL/SSH  handshake   completed.    See
78              CURLINFO_APPCONNECT_TIME(3)
79
80       CURLINFO_APPCONNECT_TIME_T
81              Time   from   start  until  SSL/SSH  handshake  completed.   See
82              CURLINFO_APPCONNECT_TIME_T(3)
83
84       CURLINFO_PRETRANSFER_TIME
85              Time from start until just  before  the  transfer  begins.   See
86              CURLINFO_PRETRANSFER_TIME(3)
87
88       CURLINFO_PRETRANSFER_TIME_T
89              Time  from  start  until  just  before the transfer begins.  See
90              CURLINFO_PRETRANSFER_TIME_T(3)
91
92       CURLINFO_STARTTRANSFER_TIME
93              Time from start until just when the first byte is received.  See
94              CURLINFO_STARTTRANSFER_TIME(3)
95
96       CURLINFO_STARTTRANSFER_TIME_T
97              Time from start until just when the first byte is received.  See
98              CURLINFO_STARTTRANSFER_TIME_T(3)
99
100       CURLINFO_REDIRECT_TIME
101              Time taken for all redirect steps  before  the  final  transfer.
102              See CURLINFO_REDIRECT_TIME(3)
103
104       CURLINFO_REDIRECT_TIME_T
105              Time  taken  for  all  redirect steps before the final transfer.
106              See CURLINFO_REDIRECT_TIME_T(3)
107
108       CURLINFO_REDIRECT_COUNT
109              Total number of redirects that were followed.  See  CURLINFO_RE‐
110              DIRECT_COUNT(3)
111
112       CURLINFO_REDIRECT_URL
113              URL  a  redirect  would  take you to, had you enabled redirects.
114              See CURLINFO_REDIRECT_URL(3)
115
116       CURLINFO_SIZE_UPLOAD
117              (Deprecated) Number of bytes  uploaded.   See  CURLINFO_SIZE_UP‐
118              LOAD(3)
119
120       CURLINFO_SIZE_UPLOAD_T
121              Number of bytes uploaded.  See CURLINFO_SIZE_UPLOAD_T(3)
122
123       CURLINFO_SIZE_DOWNLOAD
124              (Deprecated)     Number     of     bytes     downloaded.     See
125              CURLINFO_SIZE_DOWNLOAD(3)
126
127       CURLINFO_SIZE_DOWNLOAD_T
128              Number of bytes downloaded.  See CURLINFO_SIZE_DOWNLOAD_T(3)
129
130       CURLINFO_SPEED_DOWNLOAD
131              (Deprecated) Average download speed.   See  CURLINFO_SPEED_DOWN‐
132              LOAD(3)
133
134       CURLINFO_SPEED_DOWNLOAD_T
135              Average download speed.  See CURLINFO_SPEED_DOWNLOAD_T(3)
136
137       CURLINFO_SPEED_UPLOAD
138              (Deprecated) Average upload speed.  See CURLINFO_SPEED_UPLOAD(3)
139
140       CURLINFO_SPEED_UPLOAD_T
141              Average upload speed.  See CURLINFO_SPEED_UPLOAD_T(3)
142
143       CURLINFO_HEADER_SIZE
144              Number    of    bytes    of    all    headers   received.    See
145              CURLINFO_HEADER_SIZE(3)
146
147       CURLINFO_REQUEST_SIZE
148              Number  of  bytes  sent  in  the  issued  HTTP  requests.    See
149              CURLINFO_REQUEST_SIZE(3)
150
151       CURLINFO_SSL_VERIFYRESULT
152              Certificate  verification  result.   See  CURLINFO_SSL_VERIFYRE‐
153              SULT(3)
154
155       CURLINFO_PROXY_ERROR
156              Detailed proxy error.  See CURLINFO_PROXY_ERROR(3)
157
158       CURLINFO_PROXY_SSL_VERIFYRESULT
159              Proxy      certificate      verification      result.        See
160              CURLINFO_PROXY_SSL_VERIFYRESULT(3)
161
162       CURLINFO_SSL_ENGINES
163              A list of OpenSSL crypto engines.  See CURLINFO_SSL_ENGINES(3)
164
165       CURLINFO_CONTENT_LENGTH_DOWNLOAD
166              (Deprecated) Content length from the Content-Length header.  See
167              CURLINFO_CONTENT_LENGTH_DOWNLOAD(3)
168
169       CURLINFO_CONTENT_LENGTH_DOWNLOAD_T
170              Content   length   from   the   Content-Length   header.     See
171              CURLINFO_CONTENT_LENGTH_DOWNLOAD_T(3)
172
173       CURLINFO_CONTENT_LENGTH_UPLOAD
174              (Deprecated) Upload size. See CURLINFO_CONTENT_LENGTH_UPLOAD(3)
175
176       CURLINFO_CONTENT_LENGTH_UPLOAD_T
177              Upload size. See CURLINFO_CONTENT_LENGTH_UPLOAD_T(3)
178
179       CURLINFO_CONTENT_TYPE
180              Content  type  from  the Content-Type header.  See CURLINFO_CON‐
181              TENT_TYPE(3)
182
183       CURLINFO_RETRY_AFTER
184              The value from the Retry-After header.   See  CURLINFO_RETRY_AF‐
185              TER(3)
186
187       CURLINFO_PRIVATE
188              User's private data pointer.  See CURLINFO_PRIVATE(3)
189
190       CURLINFO_HTTPAUTH_AVAIL
191              Available       HTTP      authentication      methods.       See
192              CURLINFO_HTTPAUTH_AVAIL(3)
193
194       CURLINFO_PROXYAUTH_AVAIL
195              Available HTTP proxy authentication methods.  See CURLINFO_PROX‐
196              YAUTH_AVAIL(3)
197
198       CURLINFO_OS_ERRNO
199              The errno from the last failure to connect.  See CURLINFO_OS_ER‐
200              RNO(3)
201
202       CURLINFO_NUM_CONNECTS
203              Number of new successful connections used for previous transfer.
204              See CURLINFO_NUM_CONNECTS(3)
205
206       CURLINFO_PRIMARY_IP
207              IP address of the last connection.  See CURLINFO_PRIMARY_IP(3)
208
209       CURLINFO_PRIMARY_PORT
210              Port of the last connection.  See CURLINFO_PRIMARY_PORT(3)
211
212       CURLINFO_LOCAL_IP
213              Local-end  IP  address  of  last  connection.   See CURLINFO_LO‐
214              CAL_IP(3)
215
216       CURLINFO_LOCAL_PORT
217              Local-end port of last connection.  See CURLINFO_LOCAL_PORT(3)
218
219       CURLINFO_COOKIELIST
220              List of all known cookies.  See CURLINFO_COOKIELIST(3)
221
222       CURLINFO_LASTSOCKET
223              (Deprecated) Last socket used.  See CURLINFO_LASTSOCKET(3)
224
225       CURLINFO_ACTIVESOCKET
226              The session's active socket.  See CURLINFO_ACTIVESOCKET(3)
227
228       CURLINFO_FTP_ENTRY_PATH
229              The  entry  path  after  logging  in  to  an  FTP  server.   See
230              CURLINFO_FTP_ENTRY_PATH(3)
231
232       CURLINFO_CAPATH
233              Get  the default value for CURLOPT_CAPATH(3).  See CURLINFO_CAP‐
234              ATH(3)
235
236       CURLINFO_CAINFO
237              Get   the   default   value    for    CURLOPT_CAINFO(3).     See
238              CURLINFO_CAINFO(3)
239
240       CURLINFO_CERTINFO
241              Certificate chain.  See CURLINFO_CERTINFO(3)
242
243       CURLINFO_TLS_SSL_PTR
244              TLS  session  info that can be used for further processing.  See
245              CURLINFO_TLS_SSL_PTR(3)
246
247       CURLINFO_TLS_SESSION
248              TLS session info that can be used for  further  processing.  See
249              CURLINFO_TLS_SESSION(3).       Deprecated       option,      use
250              CURLINFO_TLS_SSL_PTR(3) instead!
251
252       CURLINFO_CONDITION_UNMET
253              Whether or not a time conditional was met or 304 HTTP  response.
254              See CURLINFO_CONDITION_UNMET(3)
255
256       CURLINFO_RTSP_SESSION_ID
257              RTSP session ID.  See CURLINFO_RTSP_SESSION_ID(3)
258
259       CURLINFO_RTSP_CLIENT_CSEQ
260              RTSP     CSeq     that     will     next     be    used.     See
261              CURLINFO_RTSP_CLIENT_CSEQ(3)
262
263       CURLINFO_RTSP_SERVER_CSEQ
264              RTSP    CSeq    that    will    next    be    expected.      See
265              CURLINFO_RTSP_SERVER_CSEQ(3)
266
267       CURLINFO_RTSP_CSEQ_RECV
268              RTSP CSeq last received.  See CURLINFO_RTSP_CSEQ_RECV(3)
269
270       CURLINFO_PROTOCOL
271              (Deprecated)  The  protocol  used  for the connection. (Added in
272              7.52.0) See CURLINFO_PROTOCOL(3)
273
274       CURLINFO_SCHEME
275              The scheme used  for  the  connection.  (Added  in  7.52.0)  See
276              CURLINFO_SCHEME(3)
277
278       CURLINFO_CONN_ID
279              The  ID  of  the last connection used by the transfer. (Added in
280              8.2.0) See CURLINFO_CONN_ID(3)
281
282       CURLINFO_XFER_ID
283              The ID of the transfer. (Added in 8.2.0) See CURLINFO_XFER_ID(3)
284

TIMES

286       An overview of the six time values available from curl_easy_getinfo()
287
288       curl_easy_perform()
289           |
290           |--NAMELOOKUP
291           |--|--CONNECT
292           |--|--|--APPCONNECT
293           |--|--|--|--PRETRANSFER
294           |--|--|--|--|--STARTTRANSFER
295           |--|--|--|--|--|--TOTAL
296           |--|--|--|--|--|--REDIRECT
297
298       NAMELOOKUP
299              CURLINFO_NAMELOOKUP_TIME  and  CURLINFO_NAMELOOKUP_TIME_T.   The
300              time  it  took  from the start until the name resolving was com‐
301              pleted.
302
303       CONNECT
304              CURLINFO_CONNECT_TIME and CURLINFO_CONNECT_TIME_T.  The time  it
305              took  from  the  start  until the connect to the remote host (or
306              proxy) was completed.
307
308       APPCONNECT
309              CURLINFO_APPCONNECT_TIME  and  CURLINFO_APPCONNECT_TIME_T.   The
310              time it took from the start until the SSL connect/handshake with
311              the remote host was completed. (Added in 7.19.0) The  latter  is
312              the integer version (measuring microseconds).  (Added in 7.60.0)
313
314       PRETRANSFER
315              CURLINFO_PRETRANSFER_TIME  and CURLINFO_PRETRANSFER_TIME_T.  The
316              time it took from the start until  the  file  transfer  is  just
317              about  to begin. This includes all pre-transfer commands and ne‐
318              gotiations that are specific to the particular  protocol(s)  in‐
319              volved.
320
321       STARTTRANSFER
322              CURLINFO_STARTTRANSFER_TIME  and  CURLINFO_STARTTRANSFER_TIME_T.
323              The time it took from the start until the first byte is received
324              by libcurl.
325
326       TOTAL  CURLINFO_TOTAL_TIME  and  CURLINFO_TOTAL_TIME_T.   Total time of
327              the previous request.
328
329       REDIRECT
330              CURLINFO_REDIRECT_TIME and CURLINFO_REDIRECT_TIME_T.   The  time
331              it  took for all redirection steps include name lookup, connect,
332              pretransfer and transfer before final transaction  was  started.
333              So, this is zero if no redirection took place.
334

EXAMPLE

336         curl = curl_easy_init();
337         if(curl) {
338           curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
339           res = curl_easy_perform(curl);
340
341           if(CURLE_OK == res) {
342             char *ct;
343             /* ask for the content-type */
344             res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
345
346             if((CURLE_OK == res) && ct)
347               printf("We received Content-Type: %s\n", ct);
348           }
349
350           /* always cleanup */
351           curl_easy_cleanup(curl);
352         }
353

AVAILABILITY

355       Added in 7.4.1
356

RETURN VALUE

358       If the operation was successful, CURLE_OK is returned. Otherwise an ap‐
359       propriate error code will be returned.
360

SEE ALSO

362       curl_easy_setopt(3)
363
364
365
366libcurl 8.2.1                    May 23, 2023             curl_easy_getinfo(3)
Impressum