curl_easy_getinfo.3 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" **************************************************************************
  22. .\"
  23. .TH curl_easy_getinfo 3 "11 Feb 2009" "libcurl 7.19.4" "libcurl Manual"
  24. .SH NAME
  25. curl_easy_getinfo - extract information from a curl handle
  26. .SH SYNOPSIS
  27. .B #include <curl/curl.h>
  28. .B "CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ... );"
  29. .SH DESCRIPTION
  30. Request internal information from the curl session with this function. The
  31. third argument \fBMUST\fP be a pointer to a long, a pointer to a char *, a
  32. pointer to a struct curl_slist * or a pointer to a double (as this
  33. documentation describes further down). The data pointed-to will be filled in
  34. accordingly and can be relied upon only if the function returns CURLE_OK. Use
  35. this function AFTER a performed transfer if you want to get transfer related
  36. data.
  37. You should not free the memory returned by this function unless it is
  38. explicitly mentioned below.
  39. .SH AVAILABLE INFORMATION
  40. The following information can be extracted:
  41. .IP CURLINFO_EFFECTIVE_METHOD
  42. Last used HTTP method.
  43. See \fICURLINFO_EFFECTIVE_METHOD(3)\fP
  44. .IP CURLINFO_EFFECTIVE_URL
  45. Last used URL.
  46. See \fICURLINFO_EFFECTIVE_URL(3)\fP
  47. .IP CURLINFO_RESPONSE_CODE
  48. Last received response code.
  49. See \fICURLINFO_RESPONSE_CODE(3)\fP
  50. .IP CURLINFO_REFERER
  51. Referrer header.
  52. See \fICURLINFO_REFERER(3)\fP
  53. .IP CURLINFO_HTTP_CONNECTCODE
  54. Last proxy CONNECT response code.
  55. See \fICURLINFO_HTTP_CONNECTCODE(3)\fP
  56. .IP CURLINFO_HTTP_VERSION
  57. The http version used in the connection.
  58. See \fICURLINFO_HTTP_VERSION(3)\fP
  59. .IP CURLINFO_FILETIME
  60. Remote time of the retrieved document. See \fICURLINFO_FILETIME(3)\fP
  61. .IP CURLINFO_FILETIME_T
  62. Remote time of the retrieved document. See \fICURLINFO_FILETIME_T(3)\fP
  63. .IP CURLINFO_TOTAL_TIME
  64. Total time of previous transfer.
  65. See \fICURLINFO_TOTAL_TIME(3)\fP
  66. .IP CURLINFO_TOTAL_TIME_T
  67. Total time of previous transfer.
  68. See \fICURLINFO_TOTAL_TIME_T(3)\fP
  69. .IP CURLINFO_NAMELOOKUP_TIME
  70. Time from start until name resolving completed.
  71. See \fICURLINFO_NAMELOOKUP_TIME(3)\fP
  72. .IP CURLINFO_NAMELOOKUP_TIME_T
  73. Time from start until name resolving completed.
  74. See \fICURLINFO_NAMELOOKUP_TIME_T(3)\fP
  75. .IP CURLINFO_CONNECT_TIME
  76. Time from start until remote host or proxy completed.
  77. See \fICURLINFO_CONNECT_TIME(3)\fP
  78. .IP CURLINFO_CONNECT_TIME_T
  79. Time from start until remote host or proxy completed.
  80. See \fICURLINFO_CONNECT_TIME_T(3)\fP
  81. .IP CURLINFO_APPCONNECT_TIME
  82. Time from start until SSL/SSH handshake completed.
  83. See \fICURLINFO_APPCONNECT_TIME(3)\fP
  84. .IP CURLINFO_APPCONNECT_TIME_T
  85. Time from start until SSL/SSH handshake completed.
  86. See \fICURLINFO_APPCONNECT_TIME_T(3)\fP
  87. .IP CURLINFO_PRETRANSFER_TIME
  88. Time from start until just before the transfer begins.
  89. See \fICURLINFO_PRETRANSFER_TIME(3)\fP
  90. .IP CURLINFO_PRETRANSFER_TIME_T
  91. Time from start until just before the transfer begins.
  92. See \fICURLINFO_PRETRANSFER_TIME_T(3)\fP
  93. .IP CURLINFO_STARTTRANSFER_TIME
  94. Time from start until just when the first byte is received.
  95. See \fICURLINFO_STARTTRANSFER_TIME(3)\fP
  96. .IP CURLINFO_STARTTRANSFER_TIME_T
  97. Time from start until just when the first byte is received.
  98. See \fICURLINFO_STARTTRANSFER_TIME_T(3)\fP
  99. .IP CURLINFO_REDIRECT_TIME
  100. Time taken for all redirect steps before the final transfer.
  101. See \fICURLINFO_REDIRECT_TIME(3)\fP
  102. .IP CURLINFO_REDIRECT_TIME_T
  103. Time taken for all redirect steps before the final transfer.
  104. See \fICURLINFO_REDIRECT_TIME_T(3)\fP
  105. .IP CURLINFO_REDIRECT_COUNT
  106. Total number of redirects that were followed.
  107. See \fICURLINFO_REDIRECT_COUNT(3)\fP
  108. .IP CURLINFO_REDIRECT_URL
  109. URL a redirect would take you to, had you enabled redirects.
  110. See \fICURLINFO_REDIRECT_URL(3)\fP
  111. .IP CURLINFO_SIZE_UPLOAD
  112. (Deprecated) Number of bytes uploaded.
  113. See \fICURLINFO_SIZE_UPLOAD(3)\fP
  114. .IP CURLINFO_SIZE_UPLOAD_T
  115. Number of bytes uploaded.
  116. See \fICURLINFO_SIZE_UPLOAD_T(3)\fP
  117. .IP CURLINFO_SIZE_DOWNLOAD
  118. (Deprecated) Number of bytes downloaded.
  119. See \fICURLINFO_SIZE_DOWNLOAD(3)\fP
  120. .IP CURLINFO_SIZE_DOWNLOAD_T
  121. Number of bytes downloaded.
  122. See \fICURLINFO_SIZE_DOWNLOAD_T(3)\fP
  123. .IP CURLINFO_SPEED_DOWNLOAD
  124. (Deprecated) Average download speed.
  125. See \fICURLINFO_SPEED_DOWNLOAD(3)\fP
  126. .IP CURLINFO_SPEED_DOWNLOAD_T
  127. Average download speed.
  128. See \fICURLINFO_SPEED_DOWNLOAD_T(3)\fP
  129. .IP CURLINFO_SPEED_UPLOAD
  130. (Deprecated) Average upload speed.
  131. See \fICURLINFO_SPEED_UPLOAD(3)\fP
  132. .IP CURLINFO_SPEED_UPLOAD_T
  133. Average upload speed.
  134. See \fICURLINFO_SPEED_UPLOAD_T(3)\fP
  135. .IP CURLINFO_HEADER_SIZE
  136. Number of bytes of all headers received.
  137. See \fICURLINFO_HEADER_SIZE(3)\fP
  138. .IP CURLINFO_REQUEST_SIZE
  139. Number of bytes sent in the issued HTTP requests.
  140. See \fICURLINFO_REQUEST_SIZE(3)\fP
  141. .IP CURLINFO_SSL_VERIFYRESULT
  142. Certificate verification result.
  143. See \fICURLINFO_SSL_VERIFYRESULT(3)\fP
  144. .IP CURLINFO_PROXY_ERROR
  145. Detailed proxy error.
  146. See \fICURLINFO_PROXY_ERROR(3)\fP
  147. .IP CURLINFO_PROXY_SSL_VERIFYRESULT
  148. Proxy certificate verification result.
  149. See \fICURLINFO_PROXY_SSL_VERIFYRESULT(3)\fP
  150. .IP CURLINFO_SSL_ENGINES
  151. A list of OpenSSL crypto engines.
  152. See \fICURLINFO_SSL_ENGINES(3)\fP
  153. .IP CURLINFO_CONTENT_LENGTH_DOWNLOAD
  154. (Deprecated) Content length from the Content-Length header.
  155. See \fICURLINFO_CONTENT_LENGTH_DOWNLOAD(3)\fP
  156. .IP CURLINFO_CONTENT_LENGTH_DOWNLOAD_T
  157. Content length from the Content-Length header.
  158. See \fICURLINFO_CONTENT_LENGTH_DOWNLOAD_T(3)\fP
  159. .IP CURLINFO_CONTENT_LENGTH_UPLOAD
  160. (Deprecated) Upload size. See \fICURLINFO_CONTENT_LENGTH_UPLOAD(3)\fP
  161. .IP CURLINFO_CONTENT_LENGTH_UPLOAD_T
  162. Upload size. See \fICURLINFO_CONTENT_LENGTH_UPLOAD_T(3)\fP
  163. .IP CURLINFO_CONTENT_TYPE
  164. Content type from the Content-Type header.
  165. See \fICURLINFO_CONTENT_TYPE(3)\fP
  166. .IP CURLINFO_RETRY_AFTER
  167. The value from the from the Retry-After header.
  168. See \fICURLINFO_RETRY_AFTER(3)\fP
  169. .IP CURLINFO_PRIVATE
  170. User's private data pointer.
  171. See \fICURLINFO_PRIVATE(3)\fP
  172. .IP CURLINFO_HTTPAUTH_AVAIL
  173. Available HTTP authentication methods.
  174. See \fICURLINFO_HTTPAUTH_AVAIL(3)\fP
  175. .IP CURLINFO_PROXYAUTH_AVAIL
  176. Available HTTP proxy authentication methods.
  177. See \fICURLINFO_PROXYAUTH_AVAIL(3)\fP
  178. .IP CURLINFO_OS_ERRNO
  179. The errno from the last failure to connect.
  180. See \fICURLINFO_OS_ERRNO(3)\fP
  181. .IP CURLINFO_NUM_CONNECTS
  182. Number of new successful connections used for previous transfer.
  183. See \fICURLINFO_NUM_CONNECTS(3)\fP
  184. .IP CURLINFO_PRIMARY_IP
  185. IP address of the last connection.
  186. See \fICURLINFO_PRIMARY_IP(3)\fP
  187. .IP CURLINFO_PRIMARY_PORT
  188. Port of the last connection.
  189. See \fICURLINFO_PRIMARY_PORT(3)\fP
  190. .IP CURLINFO_LOCAL_IP
  191. Local-end IP address of last connection.
  192. See \fICURLINFO_LOCAL_IP(3)\fP
  193. .IP CURLINFO_LOCAL_PORT
  194. Local-end port of last connection.
  195. See \fICURLINFO_LOCAL_PORT(3)\fP
  196. .IP CURLINFO_COOKIELIST
  197. List of all known cookies.
  198. See \fICURLINFO_COOKIELIST(3)\fP
  199. .IP CURLINFO_LASTSOCKET
  200. Last socket used.
  201. See \fICURLINFO_LASTSOCKET(3)\fP
  202. .IP CURLINFO_ACTIVESOCKET
  203. The session's active socket.
  204. See \fICURLINFO_ACTIVESOCKET(3)\fP
  205. .IP CURLINFO_FTP_ENTRY_PATH
  206. The entry path after logging in to an FTP server.
  207. See \fICURLINFO_FTP_ENTRY_PATH(3)\fP
  208. .IP CURLINFO_CERTINFO
  209. Certificate chain.
  210. See \fICURLINFO_CERTINFO(3)\fP
  211. .IP CURLINFO_TLS_SSL_PTR
  212. TLS session info that can be used for further processing.
  213. See \fICURLINFO_TLS_SSL_PTR(3)\fP
  214. .IP CURLINFO_TLS_SESSION
  215. TLS session info that can be used for further processing. See
  216. \fICURLINFO_TLS_SESSION(3)\fP. Deprecated option, use
  217. \fICURLINFO_TLS_SSL_PTR(3)\fP instead!
  218. .IP CURLINFO_CONDITION_UNMET
  219. Whether or not a time conditional was met or 304 HTTP response.
  220. See \fICURLINFO_CONDITION_UNMET(3)\fP
  221. .IP CURLINFO_RTSP_SESSION_ID
  222. RTSP session ID.
  223. See \fICURLINFO_RTSP_SESSION_ID(3)\fP
  224. .IP CURLINFO_RTSP_CLIENT_CSEQ
  225. RTSP CSeq that will next be used.
  226. See \fICURLINFO_RTSP_CLIENT_CSEQ(3)\fP
  227. .IP CURLINFO_RTSP_SERVER_CSEQ
  228. RTSP CSeq that will next be expected.
  229. See \fICURLINFO_RTSP_SERVER_CSEQ(3)\fP
  230. .IP CURLINFO_RTSP_CSEQ_RECV
  231. RTSP CSeq last received.
  232. See \fICURLINFO_RTSP_CSEQ_RECV(3)\fP
  233. .IP CURLINFO_PROTOCOL
  234. The protocol used for the connection. (Added in 7.52.0)
  235. See \fICURLINFO_PROTOCOL(3)\fP
  236. .IP CURLINFO_SCHEME
  237. The scheme used for the connection. (Added in 7.52.0)
  238. See \fICURLINFO_SCHEME(3)\fP
  239. .SH TIMES
  240. .nf
  241. An overview of the six time values available from curl_easy_getinfo()
  242. curl_easy_perform()
  243. |
  244. |--NAMELOOKUP
  245. |--|--CONNECT
  246. |--|--|--APPCONNECT
  247. |--|--|--|--PRETRANSFER
  248. |--|--|--|--|--STARTTRANSFER
  249. |--|--|--|--|--|--TOTAL
  250. |--|--|--|--|--|--REDIRECT
  251. .fi
  252. .IP NAMELOOKUP
  253. \fICURLINFO_NAMELOOKUP_TIME\fP and \fICURLINFO_NAMELOOKUP_TIME_T\fP.
  254. The time it took from the start until the name resolving was completed.
  255. .IP CONNECT
  256. \fICURLINFO_CONNECT_TIME\fP and \fICURLINFO_CONNECT_TIME_T\fP.
  257. The time it took from the start until the connect
  258. to the remote host (or proxy) was completed.
  259. .IP APPCONNECT
  260. \fICURLINFO_APPCONNECT_TIME\fP and \fICURLINFO_APPCONNECT_TIME_T\fP.
  261. The time it took from the start until the SSL
  262. connect/handshake with the remote host was completed. (Added in 7.19.0)
  263. The latter is the integer version (measuring microseconds). (Added in 7.60.0)
  264. .IP PRETRANSFER
  265. \fICURLINFO_PRETRANSFER_TIME\fP and \fICURLINFO_PRETRANSFER_TIME_T\fP.
  266. The time it took from the start until the
  267. file transfer is just about to begin. This includes all pre-transfer commands
  268. and negotiations that are specific to the particular protocol(s) involved.
  269. .IP STARTTRANSFER
  270. \fICURLINFO_STARTTRANSFER_TIME\fP and \fICURLINFO_STARTTRANSFER_TIME_T\fP.
  271. The time it took from the start until the
  272. first byte is received by libcurl.
  273. .IP TOTAL
  274. \fICURLINFO_TOTAL_TIME\fP and \fICURLINFO_TOTAL_TIME_T\fP.
  275. Total time of the previous request.
  276. .IP REDIRECT
  277. \fICURLINFO_REDIRECT_TIME\fP and \fICURLINFO_REDIRECT_TIME_T\fP.
  278. The time it took for all redirection steps
  279. include name lookup, connect, pretransfer and transfer before final
  280. transaction was started. So, this is zero if no redirection took place.
  281. .SH RETURN VALUE
  282. If the operation was successful, CURLE_OK is returned. Otherwise an
  283. appropriate error code will be returned.
  284. .SH "SEE ALSO"
  285. .BR curl_easy_setopt "(3)"