curl_easy_getinfo(3)
π curl_easy_getinfo(3) π
from the Library Functions Manual β yes bestie, we're deep in the man pages now. π«Ά
πΈ NAME πΈ
curl_easy_getinfo β extract information from a curl handle. Like, it's the info desk for your curl handle, periodt. π
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ... );
π« DESCRIPTION π«
Okay so this function gets the info kept in the curl handle. The third argument MUST be pointing to the specific type of the used option β and each info option's own man page documents that type. Don't just vibe-check it, bestie, get the type right. π
The data is stored accordingly, and you can only rely on it if this function returns CURLE_OK. So like, check the return value, no cap. Use this function after a performed transfer if you want to get transfer related data. Yes, after β it's giving "receipts after the fact." π₯
π¨ Important: You should not free the memory returned by this function unless it is explicitly mentioned below. Like, do not touch it. Leave it alone. Periodt. π
π OPTIONS π
The following information can be extracted β okay bestie, here's the menu:
CURLINFO_ACTIVESOCKETβ The session's active socket. SeeCURLINFO_ACTIVESOCKET(3).CURLINFO_APPCONNECT_TIMEβ The time it took from the start until the SSL connect/handshake with the remote host was completed as a double in number of seconds. β±οΈCURLINFO_APPCONNECT_TIME_Tβ Same energy, but the time it took from the start until the SSL connect/handshake with the remote host was completed in number of microseconds. (Added in 7.60.0) SeeCURLINFO_APPCONNECT_TIME_T(3).CURLINFO_CAINFOβ Get the default value forCURLOPT_CAINFO(3). SeeCURLINFO_CAINFO(3).CURLINFO_CAPATHβ Get the default value forCURLOPT_CAPATH(3). SeeCURLINFO_CAPATH(3).CURLINFO_CERTINFOβ Certificate chain. SeeCURLINFO_CERTINFO(3).CURLINFO_CONDITION_UNMETβ Whether or not a time conditional was met or 304 HTTP response. SeeCURLINFO_CONDITION_UNMET(3).CURLINFO_CONNECT_TIMEβ The time it took from the start until the connect to the remote host (or proxy) was completed. As a double. SeeCURLINFO_CONNECT_TIME(3).CURLINFO_CONNECT_TIME_Tβ The time it took from the start until the connect to the remote host (or proxy) was completed. In microseconds. SeeCURLINFO_CONNECT_TIME_T(3).CURLINFO_CONN_IDβ The ID of the last connection used by the transfer. (Added in 8.2.0) SeeCURLINFO_CONN_ID(3).CURLINFO_CONTENT_LENGTH_DOWNLOADβ (Deprecated) Content length from the Content-Length header. SeeCURLINFO_CONTENT_LENGTH_DOWNLOAD(3).CURLINFO_CONTENT_LENGTH_DOWNLOAD_Tβ Content length from the Content-Length header. SeeCURLINFO_CONTENT_LENGTH_DOWNLOAD_T(3).CURLINFO_CONTENT_LENGTH_UPLOADβ (Deprecated) Upload size. SeeCURLINFO_CONTENT_LENGTH_UPLOAD(3).CURLINFO_CONTENT_LENGTH_UPLOAD_Tβ Upload size. SeeCURLINFO_CONTENT_LENGTH_UPLOAD_T(3).CURLINFO_CONTENT_TYPEβ Content type from the Content-Type: header. We recommend usingcurl_easy_header(3)instead. SeeCURLINFO_CONTENT_TYPE(3).CURLINFO_COOKIELISTβ List of all known cookies. SeeCURLINFO_COOKIELIST(3). πͺCURLINFO_EARLYDATA_SENT_Tβ Amount of TLS early data sent (in number of bytes) whenCURLSSLOPT_EARLYDATAis enabled. No cap, that's the whole thing.CURLINFO_EFFECTIVE_METHODβ Last used HTTP method. SeeCURLINFO_EFFECTIVE_METHOD(3).CURLINFO_EFFECTIVE_URLβ Last used URL. SeeCURLINFO_EFFECTIVE_URL(3).CURLINFO_FILETIMEβ Remote time of the retrieved document. SeeCURLINFO_FILETIME(3).CURLINFO_FILETIME_Tβ Remote time of the retrieved document. SeeCURLINFO_FILETIME_T(3).CURLINFO_FTP_ENTRY_PATHβ The entry path after logging in to an FTP server. SeeCURLINFO_FTP_ENTRY_PATH(3).CURLINFO_HEADER_SIZEβ Number of bytes of all headers received. SeeCURLINFO_HEADER_SIZE(3).CURLINFO_HTTPAUTH_AVAILβ Available HTTP authentication methods. SeeCURLINFO_HTTPAUTH_AVAIL(3).CURLINFO_HTTPAUTH_USEDβ Used HTTP authentication method. SeeCURLINFO_HTTPAUTH_USED(3).CURLINFO_HTTP_CONNECTCODEβ Last proxy CONNECT response code. SeeCURLINFO_HTTP_CONNECTCODE(3).CURLINFO_HTTP_VERSIONβ The http version used in the connection. SeeCURLINFO_HTTP_VERSION(3).CURLINFO_LASTSOCKETβ (Deprecated) Last socket used. SeeCURLINFO_LASTSOCKET(3).CURLINFO_LOCAL_IPβ Source IP address of the last connection. SeeCURLINFO_LOCAL_IP(3).CURLINFO_LOCAL_PORTβ Source port number of the last connection. SeeCURLINFO_LOCAL_PORT(3).CURLINFO_NAMELOOKUP_TIMEβ Time from start until name resolving completed as a double. SeeCURLINFO_NAMELOOKUP_TIME(3).CURLINFO_NAMELOOKUP_TIME_Tβ Time from start until name resolving completed in number of microseconds. SeeCURLINFO_NAMELOOKUP_TIME_T(3).CURLINFO_NUM_CONNECTSβ Number of new successful connections used for previous transfer. SeeCURLINFO_NUM_CONNECTS(3).CURLINFO_OS_ERRNOβ The errno from the last failure to connect. SeeCURLINFO_OS_ERRNO(3).CURLINFO_POSTTRANSFER_TIME_Tβ The time it took from the start until the last byte is sent by libcurl. In microseconds. (Added in 8.10.0) SeeCURLINFO_POSTTRANSFER_TIME_T(3).CURLINFO_PRETRANSFER_TIMEβ The time it took from the start until the file transfer is just about to begin. This includes all pre-transfer commands and negotiations that are specific to the particular protocol(s) involved. SeeCURLINFO_PRETRANSFER_TIME(3).CURLINFO_PRETRANSFER_TIME_Tβ The time it took from the start until the file transfer is just about to begin. This includes all pre-transfer commands and negotiations that are specific to the particular protocol(s) involved. In microseconds. SeeCURLINFO_PRETRANSFER_TIME_T(3).CURLINFO_PRIMARY_IPβ Destination IP address of the last connection. SeeCURLINFO_PRIMARY_IP(3).CURLINFO_PRIMARY_PORTβ Destination port of the last connection. SeeCURLINFO_PRIMARY_PORT(3).CURLINFO_PRIVATEβ User's private data pointer. SeeCURLINFO_PRIVATE(3).CURLINFO_PROTOCOLβ (Deprecated) The protocol used for the connection. SeeCURLINFO_PROTOCOL(3).CURLINFO_PROXYAUTH_AVAILβ Available HTTP proxy authentication methods. SeeCURLINFO_PROXYAUTH_AVAIL(3).CURLINFO_PROXYAUTH_USEDβ Used HTTP proxy authentication methods. SeeCURLINFO_PROXYAUTH_USED(3).CURLINFO_PROXY_ERRORβ Detailed proxy error. SeeCURLINFO_PROXY_ERROR(3).CURLINFO_PROXY_SSL_VERIFYRESULTβ Proxy certificate verification result. SeeCURLINFO_PROXY_SSL_VERIFYRESULT(3).CURLINFO_QUEUE_TIME_Tβ The time during which the transfer was held in a waiting queue before it could start for real in number of microseconds. (Added in 8.6.0) SeeCURLINFO_QUEUE_TIME_T(3).CURLINFO_REDIRECT_COUNTβ Total number of redirects that were followed. SeeCURLINFO_REDIRECT_COUNT(3).CURLINFO_REDIRECT_TIMEβ The time it took for all redirection steps include name lookup, connect, pretransfer and transfer before final transaction was started. So, this is zero if no redirection took place. As a double. SeeCURLINFO_REDIRECT_TIME(3).CURLINFO_REDIRECT_TIME_Tβ The time it took for all redirection steps include name lookup, connect, pretransfer and transfer before final transaction was started. So, this is zero if no redirection took place. In number of microseconds. SeeCURLINFO_REDIRECT_TIME_T(3).CURLINFO_REDIRECT_URLβ URL a redirect would take you to, had you enabled redirects. SeeCURLINFO_REDIRECT_URL(3).CURLINFO_REFERERβ Referrer header. SeeCURLINFO_REFERER(3).CURLINFO_REQUEST_SIZEβ Number of bytes sent in the issued HTTP requests. SeeCURLINFO_REQUEST_SIZE(3).CURLINFO_RESPONSE_CODEβ Last received response code. SeeCURLINFO_RESPONSE_CODE(3).CURLINFO_RETRY_AFTERβ The value from the Retry-After header. SeeCURLINFO_RETRY_AFTER(3).CURLINFO_RTSP_CLIENT_CSEQβ The RTSP client CSeq that is expected next. SeeCURLINFO_RTSP_CLIENT_CSEQ(3).CURLINFO_RTSP_CSEQ_RECVβ RTSP CSeq last received. SeeCURLINFO_RTSP_CSEQ_RECV(3).CURLINFO_RTSP_SERVER_CSEQβ The RTSP server CSeq that is expected next. SeeCURLINFO_RTSP_SERVER_CSEQ(3).CURLINFO_RTSP_SESSION_IDβ RTSP session ID. SeeCURLINFO_RTSP_SESSION_ID(3).CURLINFO_SCHEMEβ The scheme used for the connection. SeeCURLINFO_SCHEME(3).CURLINFO_SIZE_DOWNLOADβ (Deprecated) Number of bytes downloaded. SeeCURLINFO_SIZE_DOWNLOAD(3).CURLINFO_SIZE_DOWNLOAD_Tβ Number of bytes downloaded. SeeCURLINFO_SIZE_DOWNLOAD_T(3).CURLINFO_SIZE_UPLOADβ (Deprecated) Number of bytes uploaded. SeeCURLINFO_SIZE_UPLOAD(3).CURLINFO_SIZE_UPLOAD_Tβ Number of bytes uploaded. SeeCURLINFO_SIZE_UPLOAD_T(3).CURLINFO_SPEED_DOWNLOADβ (Deprecated) Average download speed. SeeCURLINFO_SPEED_DOWNLOAD(3).CURLINFO_SPEED_DOWNLOAD_Tβ Average download speed. SeeCURLINFO_SPEED_DOWNLOAD_T(3).CURLINFO_SPEED_UPLOADβ (Deprecated) Average upload speed. SeeCURLINFO_SPEED_UPLOAD(3).CURLINFO_SPEED_UPLOAD_Tβ Average upload speed in number of bytes per second. SeeCURLINFO_SPEED_UPLOAD_T(3).CURLINFO_SSL_ENGINESβ A list of OpenSSL crypto engines. SeeCURLINFO_SSL_ENGINES(3).CURLINFO_SSL_VERIFYRESULTβ Certificate verification result. SeeCURLINFO_SSL_VERIFYRESULT(3).CURLINFO_STARTTRANSFER_TIMEβ The time it took from the start until the first byte is received by libcurl. As a double. SeeCURLINFO_STARTTRANSFER_TIME(3).CURLINFO_STARTTRANSFER_TIME_Tβ The time it took from the start until the first byte is received by libcurl. In microseconds. SeeCURLINFO_STARTTRANSFER_TIME_T(3).CURLINFO_TLS_SESSIONβ (Deprecated) TLS session info that can be used for further processing. SeeCURLINFO_TLS_SESSION(3). UseCURLINFO_TLS_SSL_PTR(3)instead.CURLINFO_TLS_SSL_PTRβ TLS session info that can be used for further processing. SeeCURLINFO_TLS_SSL_PTR(3).CURLINFO_TOTAL_TIMEβ Total time of previous transfer. SeeCURLINFO_TOTAL_TIME(3).CURLINFO_TOTAL_TIME_Tβ Total time of previous transfer. SeeCURLINFO_TOTAL_TIME_T(3).CURLINFO_USED_PROXYβ Whether the proxy was used (Added in 8.7.0). SeeCURLINFO_USED_PROXY(3).CURLINFO_XFER_IDβ The ID of the transfer. (Added in 8.2.0) SeeCURLINFO_XFER_ID(3).
β° TIMES β°
okay so this part is an overview of the time values available from curl_easy_getinfo(3) β and highkey the way they nest together is giving main character energy, no cap. here's the exact timeline tree vibe:
curl_easy_perform()
|
|--QUEUE
|--|--NAMELOOKUP
|--|--|--CONNECT
|--|--|--|--APPCONNECT
|--|--|--|--|--PRETRANSFER
|--|--|--|--|--|--POSTTRANSFER
|--|--|--|--|--|--|--STARTTRANSFER
|--|--|--|--|--|--|--|--TOTAL
|--|--|--|--|--|--|--|--REDIRECT
and these are the time constants you can ask for, bestie, in this exact order:
CURLINFO_QUEUE_TIME_T(3)CURLINFO_NAMELOOKUP_TIME_T(3)CURLINFO_CONNECT_TIME_T(3)CURLINFO_APPCONNECT_TIME_T(3)CURLINFO_PRETRANSFER_TIME_T(3)CURLINFO_POSTTRANSFER_TIME_T(3)CURLINFO_STARTTRANSFER_TIME_T(3)CURLINFO_TOTAL_TIME_T(3)CURLINFO_REDIRECT_TIME_T(3)
π PROTOCOLS π
This functionality affects all supported protocols β¨
π EXAMPLE π
bestie, here's the whole C example in all its glory β it asks for the content-type and prints it if the result is CURLE_OK, fr fr:
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
result = curl_easy_perform(curl);
if(CURLE_OK == result) {
char *ct;
/* ask for the content-type */
result = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
if((CURLE_OK == result) && ct)
printf("We received Content-Type: %s\n", ct);
}
/* always cleanup */
curl_easy_cleanup(curl);
}
}
π¦ AVAILABILITY π¦
Added in curl 7.4.1 β periodt. π
π RETURN VALUE π
This function returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred β see libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3) there can be an error message stored in the error buffer when non-zero is returned. ngl, that's the whole return-value tea π΅
πΈ SEE ALSO πΈ
this iconic page is from libcurl, dated 2026-10-12, and it's all about curl_easy_getinfo(3) β hope you slayed those time values, bestie πβ¨π¦
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms