CURLINFO_A...ECT_TIME_T(3)

πŸ’… CURLINFO_APPCONNECT_TIME_T β€” time until the SSL/SSH handshake completed

okay bestie, so this one is from section 3 of the Library Functions Manual, and it's giving "how long did the handshake drama take" energy ✨ lowkey one of the cutest little getinfo calls ngl.


✨ NAME ✨

CURLINFO_APPCONNECT_TIME_T β€” the time until the SSL/SSH handshake completed, fr fr πŸŽ€


🌸 SYNOPSIS 🌸

#include <curl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_APPCONNECT_TIME_T,
                           curl_off_t *timep);

πŸ¦‹ DESCRIPTION πŸ¦‹

So the way this works πŸ’– β€” you pass in a pointer to a curl_off_t, and it receives the time, in microseconds, that it took from the start until the SSL/SSH connect/handshake to the remote host was completed. Iconic. 🌟

And like, highkey this time is most often close to the CURLINFO_PRETRANSFER_TIME_T(3) time, except for cases such as HTTP multiplexing where the pretransfer time can be delayed due to waits in line for the stream and more. so not always twins, ok? 😭

Also!! when a redirect is followed, the time from each request is added together. every hop counts bestie πŸ’€

See also the TIMES overview in the curl_easy_getinfo(3) man page if you wanna go deeper, iykyk πŸ‘‘


🌈 PROTOCOLS 🌈

This functionality affects all supported protocols β€” literally all of them, no gatekeeping 🫢


🧚 EXAMPLE 🧚

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_off_t connect;
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
    result = curl_easy_perform(curl);
    if(CURLE_OK == result) {
      result = curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME_T, &connect);
      if(CURLE_OK == result) {
        printf("Time: %" CURL_FORMAT_CURL_OFF_T ".%06ld", connect / 1000000,
               (long)(connect % 1000000));
      }
    }
    /* always cleanup */
    curl_easy_cleanup(curl);
  }
}

the /* always cleanup */ comment is there for a reason bestie, don't ghost your handle πŸ™ˆ


⭐ AVAILABILITY ⭐

Added in curl 7.61.0 β€” a lil vintage, but still slaying πŸ’…


πŸ’œ RETURN VALUE πŸ’œ

curl_easy_getinfo(3) returns a CURLcode indicating success or error.

CURLE_OK (0) means everything was OK β€” we love a zero πŸŽ€ non-zero means an error occurred, so go check libcurl-errors(3) and figure out what went wrong, no cap.


πŸ”₯ SEE ALSO πŸ”₯


πŸ’– that's the whole vibe. go measure your handshakes, bestie. periodt.

mwah β€” this gorgeous lil page is brought to you by libcurl, dated 2026-10-12. take care of her, she's iconic πŸ‘‘βœ¨πŸ“

πŸ“¦ where this page comes from