GNURLINFO...NNECT_TIME(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸŽ€ NAME πŸŽ€

  • CURLINFO_APPCONNECT_TIME β€” get the time until the SSL/SSH handshake is completed.

okay so bestie, you're in the curl_easy_getinfo options part of the gnurl manual β€” the running head is GNURLINFO...NNECT_TIME(3) because long names get terminal-squished, not because we're being mysterious πŸ’…. This lookup hands you the SSL/SSH handshake time, and it's lowkey iconic.

✨ SYNOPSIS ✨

#include <gnurl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_APPCONNECT_TIME,
       double *timep);

πŸ’– DESCRIPTION πŸ’–

Pass a pointer to a double to receive the time, in seconds, it took from the start until the SSL/SSH connect/handshake to the remote host was completed. Yep: literally seconds, from the very start, until that handshake said "we're done here." πŸ’…

This time is most often very near to the CURLINFO_PRETRANSFER_TIME(3) time, except for cases such as HTTP pipelining where the pretransfer time can be delayed due to waits in line for the pipeline and more. No cap, that caveat is real and it matters.

When a redirect is followed, the time from each request is added together. So it's cumulative, not a single-request-only number β€” important.

See also the TIMES overview in the curl_easy_getinfo(3) man page. It's giving reference-table realness.

πŸ¦‹ PROTOCOLS πŸ¦‹

  • All β€” that's the whole protocol guest list. Everyone's invited. ✨

🌸 EXAMPLE 🌸

curl = curl_easy_init();
if(curl) {
  double connect;
  curl_easy_setopt(curl, CURLOPT_URL, url);
  res = curl_easy_perform(curl);
  if(CURLE_OK == res) {
    res = curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME, &connect);
    if(CURLE_OK == res) {
      printf("Time: %.1f", connect);
    }
  }
  /* always cleanup */
  curl_easy_cleanup(curl);
}

πŸŽ€ AVAILABILITY πŸŽ€

  • Added in 7.19.0 β€” vintage, but make it fashion. πŸ’–

πŸ”₯ RETURN VALUE πŸ”₯

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. So check your return value, bestie β€” don't just vibe and hope. 😭

πŸ’œ SEE ALSO πŸ’œ

πŸ’– That's the whole page, bestie. This manpage moment comes from libcurl 7.44.0, dated 28 Aug 2015 β€” iconic vintage, no cap. πŸŽ€βœ¨
πŸ“¦ where this page comes from