quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

curl_easy_getinfo.md (11447B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: curl_easy_getinfo
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - curl_easy_setopt (3)
      9 Protocol:
     10   - All
     11 Added-in: 7.4.1
     12 ---
     13 
     14 # NAME
     15 
     16 curl_easy_getinfo - extract information from a curl handle
     17 
     18 # SYNOPSIS
     19 
     20 ~~~c
     21 #include <curl/curl.h>
     22 
     23 CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ... );
     24 ~~~
     25 
     26 # DESCRIPTION
     27 
     28 Get the *info* kept in the *curl* handle. The third argument **MUST** be
     29 pointing to the specific type of the used option which is documented in each
     30 man page of the *info* option. The data is stored accordingly and can be
     31 relied upon only if this function returns CURLE_OK. Use this function after a
     32 performed transfer if you want to get transfer related data.
     33 
     34 You should not free the memory returned by this function unless it is
     35 explicitly mentioned below.
     36 
     37 # OPTIONS
     38 
     39 The following information can be extracted:
     40 
     41 ## CURLINFO_ACTIVESOCKET
     42 
     43 The session's active socket. See CURLINFO_ACTIVESOCKET(3)
     44 
     45 ## CURLINFO_APPCONNECT_TIME
     46 
     47 The time it took from the start until the SSL connect/handshake with the
     48 remote host was completed as a double in number of seconds. (Added in 7.19.0)
     49 
     50 ## CURLINFO_APPCONNECT_TIME_T
     51 
     52 The time it took from the start until the SSL connect/handshake with the
     53 remote host was completed in number of microseconds. (Added in 7.60.0) See
     54 CURLINFO_APPCONNECT_TIME_T(3)
     55 
     56 ## CURLINFO_CAINFO
     57 
     58 Get the default value for CURLOPT_CAINFO(3). See CURLINFO_CAINFO(3)
     59 
     60 ## CURLINFO_CAPATH
     61 
     62 Get the default value for CURLOPT_CAPATH(3). See CURLINFO_CAPATH(3)
     63 
     64 ## CURLINFO_CERTINFO
     65 
     66 Certificate chain. See CURLINFO_CERTINFO(3)
     67 
     68 ## CURLINFO_CONDITION_UNMET
     69 
     70 Whether or not a time conditional was met or 304 HTTP response.
     71 See CURLINFO_CONDITION_UNMET(3)
     72 
     73 ## CURLINFO_CONNECT_TIME
     74 
     75 The time it took from the start until the connect to the remote host (or
     76 proxy) was completed. As a double. See CURLINFO_CONNECT_TIME(3)
     77 
     78 ## CURLINFO_CONNECT_TIME_T
     79 
     80 The time it took from the start until the connect to the remote host (or
     81 proxy) was completed. In microseconds. See CURLINFO_CONNECT_TIME_T(3).
     82 
     83 ## CURLINFO_CONN_ID
     84 
     85 The ID of the last connection used by the transfer. (Added in 8.2.0)
     86 See CURLINFO_CONN_ID(3)
     87 
     88 ## CURLINFO_CONTENT_LENGTH_DOWNLOAD
     89 
     90 (**Deprecated**) Content length from the Content-Length header.
     91 See CURLINFO_CONTENT_LENGTH_DOWNLOAD(3)
     92 
     93 ## CURLINFO_CONTENT_LENGTH_DOWNLOAD_T
     94 
     95 Content length from the Content-Length header.
     96 See CURLINFO_CONTENT_LENGTH_DOWNLOAD_T(3)
     97 
     98 ## CURLINFO_CONTENT_LENGTH_UPLOAD
     99 
    100 (**Deprecated**) Upload size. See CURLINFO_CONTENT_LENGTH_UPLOAD(3)
    101 
    102 ## CURLINFO_CONTENT_LENGTH_UPLOAD_T
    103 
    104 Upload size. See CURLINFO_CONTENT_LENGTH_UPLOAD_T(3)
    105 
    106 ## CURLINFO_CONTENT_TYPE
    107 
    108 Content type from the `Content-Type:` header. We recommend using
    109 curl_easy_header(3) instead. See CURLINFO_CONTENT_TYPE(3)
    110 
    111 ## CURLINFO_COOKIELIST
    112 
    113 List of all known cookies. See CURLINFO_COOKIELIST(3)
    114 
    115 ## CURLINFO_EARLYDATA_SENT_T
    116 
    117 Amount of TLS early data sent (in number of bytes) when
    118 CURLSSLOPT_EARLYDATA is enabled.
    119 
    120 ## CURLINFO_EFFECTIVE_METHOD
    121 
    122 Last used HTTP method. See CURLINFO_EFFECTIVE_METHOD(3)
    123 
    124 ## CURLINFO_EFFECTIVE_URL
    125 
    126 Last used URL. See CURLINFO_EFFECTIVE_URL(3)
    127 
    128 ## CURLINFO_FILETIME
    129 
    130 Remote time of the retrieved document. See CURLINFO_FILETIME(3)
    131 
    132 ## CURLINFO_FILETIME_T
    133 
    134 Remote time of the retrieved document. See CURLINFO_FILETIME_T(3)
    135 
    136 ## CURLINFO_FTP_ENTRY_PATH
    137 
    138 The entry path after logging in to an FTP server. See
    139 CURLINFO_FTP_ENTRY_PATH(3)
    140 
    141 ## CURLINFO_HEADER_SIZE
    142 
    143 Number of bytes of all headers received. See CURLINFO_HEADER_SIZE(3)
    144 
    145 ## CURLINFO_HTTPAUTH_AVAIL
    146 
    147 Available HTTP authentication methods. See CURLINFO_HTTPAUTH_AVAIL(3)
    148 
    149 ## CURLINFO_HTTPAUTH_USED
    150 
    151 Used HTTP authentication method. See CURLINFO_HTTPAUTH_USED(3)
    152 
    153 ## CURLINFO_HTTP_CONNECTCODE
    154 
    155 Last proxy CONNECT response code. See CURLINFO_HTTP_CONNECTCODE(3)
    156 
    157 ## CURLINFO_HTTP_VERSION
    158 
    159 The http version used in the connection. See CURLINFO_HTTP_VERSION(3)
    160 
    161 ## CURLINFO_LASTSOCKET
    162 
    163 (**Deprecated**) Last socket used. See CURLINFO_LASTSOCKET(3)
    164 
    165 ## CURLINFO_LOCAL_IP
    166 
    167 Source IP address of the last connection. See CURLINFO_LOCAL_IP(3)
    168 
    169 ## CURLINFO_LOCAL_PORT
    170 
    171 Source port number of the last connection. See CURLINFO_LOCAL_PORT(3)
    172 
    173 ## CURLINFO_NAMELOOKUP_TIME
    174 
    175 Time from start until name resolving completed as a double. See
    176 CURLINFO_NAMELOOKUP_TIME(3)
    177 
    178 ## CURLINFO_NAMELOOKUP_TIME_T
    179 
    180 Time from start until name resolving completed in number of microseconds. See
    181 CURLINFO_NAMELOOKUP_TIME_T(3)
    182 
    183 ## CURLINFO_NUM_CONNECTS
    184 
    185 Number of new successful connections used for previous transfer.
    186 See CURLINFO_NUM_CONNECTS(3)
    187 
    188 ## CURLINFO_OS_ERRNO
    189 
    190 The errno from the last failure to connect. See CURLINFO_OS_ERRNO(3)
    191 
    192 ## CURLINFO_POSTTRANSFER_TIME_T
    193 
    194 The time it took from the start until the last byte is sent by libcurl.
    195 In microseconds. (Added in 8.10.0) See CURLINFO_POSTTRANSFER_TIME_T(3)
    196 
    197 ## CURLINFO_PRETRANSFER_TIME
    198 
    199 The time it took from the start until the file transfer is just about to
    200 begin. This includes all pre-transfer commands and negotiations that are
    201 specific to the particular protocol(s) involved. See
    202 CURLINFO_PRETRANSFER_TIME(3)
    203 
    204 ## CURLINFO_PRETRANSFER_TIME_T
    205 
    206 The time it took from the start until the file transfer is just about to
    207 begin. This includes all pre-transfer commands and negotiations that are
    208 specific to the particular protocol(s) involved. In microseconds. See
    209 CURLINFO_PRETRANSFER_TIME_T(3)
    210 
    211 ## CURLINFO_PRIMARY_IP
    212 
    213 Destination IP address of the last connection. See CURLINFO_PRIMARY_IP(3)
    214 
    215 ## CURLINFO_PRIMARY_PORT
    216 
    217 Destination port of the last connection. See CURLINFO_PRIMARY_PORT(3)
    218 
    219 ## CURLINFO_PRIVATE
    220 
    221 User's private data pointer. See CURLINFO_PRIVATE(3)
    222 
    223 ## CURLINFO_PROTOCOL
    224 
    225 (**Deprecated**) The protocol used for the connection. (Added in 7.52.0) See
    226 CURLINFO_PROTOCOL(3)
    227 
    228 ## CURLINFO_PROXYAUTH_AVAIL
    229 
    230 Available HTTP proxy authentication methods. See CURLINFO_PROXYAUTH_AVAIL(3)
    231 
    232 ## CURLINFO_PROXYAUTH_USED
    233 
    234 Used HTTP proxy authentication methods. See CURLINFO_PROXYAUTH_USED(3)
    235 
    236 ## CURLINFO_PROXY_ERROR
    237 
    238 Detailed proxy error. See CURLINFO_PROXY_ERROR(3)
    239 
    240 ## CURLINFO_PROXY_SSL_VERIFYRESULT
    241 
    242 Proxy certificate verification result. See CURLINFO_PROXY_SSL_VERIFYRESULT(3)
    243 
    244 ## CURLINFO_QUEUE_TIME_T
    245 
    246 The time during which the transfer was held in a waiting queue before it could
    247 start for real in number of microseconds. (Added in 8.6.0) See
    248 CURLINFO_QUEUE_TIME_T(3)
    249 
    250 ## CURLINFO_REDIRECT_COUNT
    251 
    252 Total number of redirects that were followed. See CURLINFO_REDIRECT_COUNT(3)
    253 
    254 ## CURLINFO_REDIRECT_TIME
    255 
    256 The time it took for all redirection steps include name lookup, connect,
    257 pretransfer and transfer before final transaction was started. So, this is
    258 zero if no redirection took place. As a double. See CURLINFO_REDIRECT_TIME(3)
    259 
    260 ## CURLINFO_REDIRECT_TIME_T
    261 
    262 The time it took for all redirection steps include name lookup, connect,
    263 pretransfer and transfer before final transaction was started. So, this is
    264 zero if no redirection took place. In number of microseconds. See
    265 CURLINFO_REDIRECT_TIME_T(3)
    266 
    267 ## CURLINFO_REDIRECT_URL
    268 
    269 URL a redirect would take you to, had you enabled redirects. See
    270 CURLINFO_REDIRECT_URL(3)
    271 
    272 ## CURLINFO_REFERER
    273 
    274 Referrer header. See CURLINFO_REFERER(3)
    275 
    276 ## CURLINFO_REQUEST_SIZE
    277 
    278 Number of bytes sent in the issued HTTP requests. See CURLINFO_REQUEST_SIZE(3)
    279 
    280 ## CURLINFO_RESPONSE_CODE
    281 
    282 Last received response code. See CURLINFO_RESPONSE_CODE(3)
    283 
    284 ## CURLINFO_RETRY_AFTER
    285 
    286 The value from the Retry-After header. See CURLINFO_RETRY_AFTER(3)
    287 
    288 ## CURLINFO_RTSP_CLIENT_CSEQ
    289 
    290 The RTSP client CSeq that is expected next. See CURLINFO_RTSP_CLIENT_CSEQ(3)
    291 
    292 ## CURLINFO_RTSP_CSEQ_RECV
    293 
    294 RTSP CSeq last received. See CURLINFO_RTSP_CSEQ_RECV(3)
    295 
    296 ## CURLINFO_RTSP_SERVER_CSEQ
    297 
    298 The RTSP server CSeq that is expected next. See CURLINFO_RTSP_SERVER_CSEQ(3)
    299 
    300 ## CURLINFO_RTSP_SESSION_ID
    301 
    302 RTSP session ID. See CURLINFO_RTSP_SESSION_ID(3)
    303 
    304 ## CURLINFO_SCHEME
    305 
    306 The scheme used for the connection. (Added in 7.52.0) See CURLINFO_SCHEME(3)
    307 
    308 ## CURLINFO_SIZE_DOWNLOAD
    309 
    310 (**Deprecated**) Number of bytes downloaded. See CURLINFO_SIZE_DOWNLOAD(3)
    311 
    312 ## CURLINFO_SIZE_DOWNLOAD_T
    313 
    314 Number of bytes downloaded. See CURLINFO_SIZE_DOWNLOAD_T(3)
    315 
    316 ## CURLINFO_SIZE_UPLOAD
    317 
    318 (**Deprecated**) Number of bytes uploaded. See CURLINFO_SIZE_UPLOAD(3)
    319 
    320 ## CURLINFO_SIZE_UPLOAD_T
    321 
    322 Number of bytes uploaded. See CURLINFO_SIZE_UPLOAD_T(3)
    323 
    324 ## CURLINFO_SPEED_DOWNLOAD
    325 
    326 (**Deprecated**) Average download speed. See CURLINFO_SPEED_DOWNLOAD(3)
    327 
    328 ## CURLINFO_SPEED_DOWNLOAD_T
    329 
    330 Average download speed. See CURLINFO_SPEED_DOWNLOAD_T(3)
    331 
    332 ## CURLINFO_SPEED_UPLOAD
    333 
    334 (**Deprecated**) Average upload speed. See CURLINFO_SPEED_UPLOAD(3)
    335 
    336 ## CURLINFO_SPEED_UPLOAD_T
    337 
    338 Average upload speed in number of bytes per second. See
    339 CURLINFO_SPEED_UPLOAD_T(3)
    340 
    341 ## CURLINFO_SSL_ENGINES
    342 
    343 A list of OpenSSL crypto engines. See CURLINFO_SSL_ENGINES(3)
    344 
    345 ## CURLINFO_SSL_VERIFYRESULT
    346 
    347 Certificate verification result. See CURLINFO_SSL_VERIFYRESULT(3)
    348 
    349 ## CURLINFO_STARTTRANSFER_TIME
    350 
    351 The time it took from the start until the first byte is received by libcurl.
    352 As a double. See CURLINFO_STARTTRANSFER_TIME(3)
    353 
    354 ## CURLINFO_STARTTRANSFER_TIME_T
    355 
    356 The time it took from the start until the first byte is received by libcurl.
    357 In microseconds. See CURLINFO_STARTTRANSFER_TIME_T(3)
    358 
    359 ## CURLINFO_TLS_SESSION
    360 
    361 (**Deprecated**) TLS session info that can be used for further processing. See
    362 CURLINFO_TLS_SESSION(3). Use CURLINFO_TLS_SSL_PTR(3) instead.
    363 
    364 ## CURLINFO_TLS_SSL_PTR
    365 
    366 TLS session info that can be used for further processing. See
    367 CURLINFO_TLS_SSL_PTR(3)
    368 
    369 ## CURLINFO_TOTAL_TIME
    370 
    371 Total time of previous transfer. See CURLINFO_TOTAL_TIME(3)
    372 
    373 ## CURLINFO_TOTAL_TIME_T
    374 
    375 Total time of previous transfer. See CURLINFO_TOTAL_TIME_T(3)
    376 
    377 ## CURLINFO_USED_PROXY
    378 
    379 Whether the proxy was used (Added in 8.7.0). See CURLINFO_USED_PROXY(3)
    380 
    381 ## CURLINFO_XFER_ID
    382 
    383 The ID of the transfer. (Added in 8.2.0) See CURLINFO_XFER_ID(3)
    384 
    385 # TIMES
    386 
    387 An overview of the time values available from curl_easy_getinfo(3)
    388 
    389     curl_easy_perform()
    390         |
    391         |--QUEUE
    392         |--|--NAMELOOKUP
    393         |--|--|--CONNECT
    394         |--|--|--|--APPCONNECT
    395         |--|--|--|--|--PRETRANSFER
    396         |--|--|--|--|--|--POSTTRANSFER
    397         |--|--|--|--|--|--|--STARTTRANSFER
    398         |--|--|--|--|--|--|--|--TOTAL
    399         |--|--|--|--|--|--|--|--REDIRECT
    400 
    401 
    402  CURLINFO_QUEUE_TIME_T(3), CURLINFO_NAMELOOKUP_TIME_T(3),
    403  CURLINFO_CONNECT_TIME_T(3), CURLINFO_APPCONNECT_TIME_T(3),
    404  CURLINFO_PRETRANSFER_TIME_T(3), CURLINFO_POSTTRANSFER_TIME_T(3),
    405  CURLINFO_STARTTRANSFER_TIME_T(3), CURLINFO_TOTAL_TIME_T(3),
    406  CURLINFO_REDIRECT_TIME_T(3)
    407 
    408 # %PROTOCOLS%
    409 
    410 # EXAMPLE
    411 
    412 ~~~c
    413 int main(void)
    414 {
    415   CURL *curl = curl_easy_init();
    416   if(curl) {
    417     CURLcode res;
    418     curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
    419     res = curl_easy_perform(curl);
    420 
    421     if(CURLE_OK == res) {
    422       char *ct;
    423       /* ask for the content-type */
    424       res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
    425 
    426       if((CURLE_OK == res) && ct)
    427         printf("We received Content-Type: %s\n", ct);
    428     }
    429 
    430     /* always cleanup */
    431     curl_easy_cleanup(curl);
    432   }
    433 }
    434 ~~~
    435 
    436 # %AVAILABILITY%
    437 
    438 # RETURN VALUE
    439 
    440 This function returns a CURLcode indicating success or error.
    441 
    442 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
    443 libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
    444 there can be an error message stored in the error buffer when non-zero is
    445 returned.