1curl_easy_getinfo(3)            libcurl Manual            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 a pointer to a long, a pointer to a char  *,
16       a  pointer  to  a struct curl_slist * or a pointer to a double (as this
17       documentation describes further down).  The  data  pointed-to  will  be
18       filled  in  accordingly and can be relied upon only if the function re‐
19       turns CURLE_OK. Use this function AFTER a  performed  transfer  if  you
20       want to get transfer related data.
21
22       You  should  not free the memory returned by this function unless it is
23       explicitly mentioned below.
24

AVAILABLE INFORMATION

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

TIMES

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

EXAMPLE

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

AVAILABILITY

349       Added in 7.4.1
350

RETURN VALUE

352       If the operation was successful, CURLE_OK is returned. Otherwise an ap‐
353       propriate error code will be returned.
354

SEE ALSO

356       curl_easy_setopt(3)
357
358
359
360libcurl 7.85.0                   May 17, 2022             curl_easy_getinfo(3)
Impressum