gnurl_easy_getinfo(3)
π
gnurl_easy_getinfo(3) β libgnurl Manual edition β¨
πΈ NAME πΈ
curl_easy_getinfo β extract information from a curl handle. That's the whole vibe: it's the little function that lets you ask a curl session what's up. π
π SYNOPSIS π
Okay so this is the C glow-up, bestie:
#include <gnurl/curl.h>
CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ... );
That's the exact signature, no cap. π«Ά
π¦ DESCRIPTION π¦
Use this function to request internal information from the curl session, like you're sliding into its DMs and asking for the tea. The third argument MUST be a pointer to a long, a pointer to a char *, a pointer to a struct curl_slist * or a pointer to a double (as this documentation describes further down). The data pointed-to will be filled in accordingly and can be relied upon only if the function returns CURLE_OK. Use this function AFTER a performed transfer if you want to get transfer related data. Periodt.
π«Ά Do not free the memory returned by this function unless it is explicitly mentioned below. That's important, bestie. Do not be out here freeing random curl memory because it will not slay.
β¨ AVAILABLE INFORMATION β¨
The following information can be extracted. Here's the menu, and yes, it's giving encyclopedia but make it cute:
CURLINFO_EFFECTIVE_METHODβ last used HTTP method. SeeCURLINFO_EFFECTIVE_METHOD(3)CURLINFO_EFFECTIVE_URLβ last used URL. SeeCURLINFO_EFFECTIVE_URL(3)CURLINFO_RESPONSE_CODEβ last received response code. SeeCURLINFO_RESPONSE_CODE(3)CURLINFO_HTTP_CONNECTCODEβ last proxyCONNECTresponse code. SeeCURLINFO_HTTP_CONNECTCODE(3)CURLINFO_HTTP_VERSIONβ the http version used in the connection. SeeCURLINFO_HTTP_VERSION(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_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_NAMELOOKUP_TIMEβ time from start until name resolving completed. SeeCURLINFO_NAMELOOKUP_TIME(3)CURLINFO_NAMELOOKUP_TIME_Tβ time from start until name resolving completed. SeeCURLINFO_NAMELOOKUP_TIME_T(3)CURLINFO_CONNECT_TIMEβ time from start until remote host or proxy completed. SeeCURLINFO_CONNECT_TIME(3)CURLINFO_CONNECT_TIME_Tβ time from start until remote host or proxy completed. SeeCURLINFO_CONNECT_TIME_T(3)CURLINFO_APPCONNECT_TIMEβ time from start until SSL/SSH handshake completed. SeeCURLINFO_APPCONNECT_TIME(3)CURLINFO_APPCONNECT_TIME_Tβ time from start until SSL/SSH handshake completed. SeeCURLINFO_APPCONNECT_TIME_T(3)CURLINFO_PRETRANSFER_TIMEβ time from start until just before the transfer begins. SeeCURLINFO_PRETRANSFER_TIME(3)CURLINFO_PRETRANSFER_TIME_Tβ time from start until just before the transfer begins. SeeCURLINFO_PRETRANSFER_TIME_T(3)CURLINFO_STARTTRANSFER_TIMEβ time from start until just when the first byte is received. SeeCURLINFO_STARTTRANSFER_TIME(3)CURLINFO_STARTTRANSFER_TIME_Tβ time from start until just when the first byte is received. SeeCURLINFO_STARTTRANSFER_TIME_T(3)CURLINFO_REDIRECT_TIMEβ time taken for all redirect steps before the final transfer. SeeCURLINFO_REDIRECT_TIME(3)CURLINFO_REDIRECT_TIME_Tβ time taken for all redirect steps before the final transfer. SeeCURLINFO_REDIRECT_TIME_T(3)CURLINFO_REDIRECT_COUNTβ total number of redirects that were followed. SeeCURLINFO_REDIRECT_COUNT(3)CURLINFO_REDIRECT_URLβ URL a redirect would take you to, had you enabled redirects. SeeCURLINFO_REDIRECT_URL(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_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_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. SeeCURLINFO_SPEED_UPLOAD_T(3)CURLINFO_HEADER_SIZEβ number of bytes of all headers received. SeeCURLINFO_HEADER_SIZE(3)CURLINFO_REQUEST_SIZEβ number of bytes sent in the issued HTTP requests. SeeCURLINFO_REQUEST_SIZE(3)CURLINFO_SSL_VERIFYRESULTβ certificate verification result. SeeCURLINFO_SSL_VERIFYRESULT(3)CURLINFO_PROXY_SSL_VERIFYRESULTβ proxy certificate verification result. SeeCURLINFO_PROXY_SSL_VERIFYRESULT(3)CURLINFO_SSL_ENGINESβ a list of OpenSSL crypto engines. SeeCURLINFO_SSL_ENGINES(3)CURLINFO_CONTENT_LENGTH_DOWNLOADβ π (Deprecated) content length from theContent-Lengthheader. SeeCURLINFO_CONTENT_LENGTH_DOWNLOAD(3)CURLINFO_CONTENT_LENGTH_DOWNLOAD_Tβ content length from theContent-Lengthheader. 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 theContent-Typeheader. SeeCURLINFO_CONTENT_TYPE(3)CURLINFO_RETRY_AFTERβ the value from theRetry-Afterheader. SeeCURLINFO_RETRY_AFTER(3)CURLINFO_PRIVATEβ user's private data pointer. SeeCURLINFO_PRIVATE(3)CURLINFO_HTTPAUTH_AVAILβ available HTTP authentication methods. SeeCURLINFO_HTTPAUTH_AVAIL(3)CURLINFO_PROXYAUTH_AVAILβ available HTTP proxy authentication methods. SeeCURLINFO_PROXYAUTH_AVAIL(3)CURLINFO_OS_ERRNOβ theerrnofrom the last failure to connect. SeeCURLINFO_OS_ERRNO(3)CURLINFO_NUM_CONNECTSβ number of new successful connections used for previous transfer. SeeCURLINFO_NUM_CONNECTS(3)CURLINFO_PRIMARY_IPβ IP address of the last connection. SeeCURLINFO_PRIMARY_IP(3)CURLINFO_PRIMARY_PORTβ port of the last connection. SeeCURLINFO_PRIMARY_PORT(3)CURLINFO_LOCAL_IPβ local-end IP address of last connection. SeeCURLINFO_LOCAL_IP(3)CURLINFO_LOCAL_PORTβ local-end port of last connection. SeeCURLINFO_LOCAL_PORT(3)CURLINFO_COOKIELISTβ list of all known cookies. SeeCURLINFO_COOKIELIST(3)CURLINFO_LASTSOCKETβ last socket used. SeeCURLINFO_LASTSOCKET(3)CURLINFO_ACTIVESOCKETβ the session's active socket. SeeCURLINFO_ACTIVESOCKET(3)CURLINFO_FTP_ENTRY_PATHβ the entry path after logging in to an FTP server. SeeCURLINFO_FTP_ENTRY_PATH(3)CURLINFO_CERTINFOβ certificate chain. SeeCURLINFO_CERTINFO(3)CURLINFO_TLS_SSL_PTRβ TLS session info that can be used for further processing. SeeCURLINFO_TLS_SSL_PTR(3)CURLINFO_TLS_SESSIONβ TLS session info that can be used for further processing. SeeCURLINFO_TLS_SESSION(3). Deprecated option, useCURLINFO_TLS_SSL_PTR(3)instead!CURLINFO_CONDITION_UNMETβ whether or not a time conditional was met or 304 HTTP response. SeeCURLINFO_CONDITION_UNMET(3)CURLINFO_RTSP_SESSION_IDβ RTSP session ID. SeeCURLINFO_RTSP_SESSION_ID(3)CURLINFO_RTSP_CLIENT_CSEQβ RTSP CSeq that will next be used. SeeCURLINFO_RTSP_CLIENT_CSEQ(3)CURLINFO_RTSP_SERVER_CSEQβ RTSP CSeq that will next be expected. SeeCURLINFO_RTSP_SERVER_CSEQ(3)CURLINFO_RTSP_CSEQ_RECVβ RTSP CSeq last received. SeeCURLINFO_RTSP_CSEQ_RECV(3)CURLINFO_PROTOCOLβ the protocol used for the connection. (Added in 7.52.0) SeeCURLINFO_PROTOCOL(3)CURLINFO_SCHEMEβ the scheme used for the connection. (Added in 7.52.0) SeeCURLINFO_SCHEME(3)
β±οΈ TIMES β±οΈ
An overview of the six time values available from curl_easy_getinfo(). And yes, the diagram is iconic:
curl_easy_perform()
|
|--NAMELOOKUP
|--|--CONNECT
|--|--|--APPCONNECT
|--|--|--|--PRETRANSFER
|--|--|--|--|--STARTTRANSFER
|--|--|--|--|--|--TOTAL
|--|--|--|--|--|--REDIRECT
π NAMELOOKUP
CURLINFO_NAMELOOKUP_TIME and CURLINFO_NAMELOOKUP_TIME_T. The time it took from the start until the name resolving was completed. Lowkey the "finding the address" era. π
π CONNECT
CURLINFO_CONNECT_TIME and CURLINFO_CONNECT_TIME_T. The time it took from the start until the connect to the remote host (or proxy) was completed. That's the "we're actually in" moment. π«Ά
π€ APPCONNECT
CURLINFO_APPCONNECT_TIME and CURLINFO_APPCONNECT_TIME_T. The time it took from the start until the SSL connect/handshake with the remote host was completed. (Added in 7.19.0) The latter is the integer version (measuring microseconds). (Added in 7.60.0) Cute little handshake timeline, slay. β¨
π¬ PRETRANSFER
CURLINFO_PRETRANSFER_TIME and 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. It's giving backstage prep. π
π STARTTRANSFER
CURLINFO_STARTTRANSFER_TIME and CURLINFO_STARTTRANSFER_TIME_T. The time it took from the start until the first byte is received by libcurl. First byte = main character entrance. π
π TOTAL
CURLINFO_TOTAL_TIME and CURLINFO_TOTAL_TIME_T. Total time of the previous request. The whole journey, periodt. β
π― REDIRECT
CURLINFO_REDIRECT_TIME and 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. No redirects, no redirect time, iykyk. π¦
π RETURN VALUE π
If the operation was successful, CURLE_OK is returned. Otherwise an appropriate error code will be returned. That's it, that's the vibe check. π«Ά
π SEE ALSO π
π₯Ί Okay bestie, cute little sign-off time: this page is from the source/versionlibcurl 7.19.4, dated11 Feb 2009, and it's thegnurl_easy_getinfo(3)manual page. Bye bestie, go get that info! πβ¨
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms