curl / Mailing Lists / curl-library / Single Mail

curl-library

Failing as fast as possible with HTTPS?

From: Mark Fine via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 5 May 2017 09:59:05 -0700

Hi!

I'm making GET and PUT requests to an endpoint with libcurl in an embedded
system. The data I am sending is ephemeral and latency sensitive and needs
to be as available as possible - failing requests quickly is highly
desired. I was wondering if there are more options I should set to enable
speedy failure in libcurl - so far I have:

  curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT_MS, 15000L);
  curl_easy_setopt(curl, CURLOPT_DNS_CACHE_TIMEOUT, 0L);
  curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1L);
  curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1L);
  curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
  curl_easy_setopt(curl, CURLOPT_TCP_KEEPINTVL, 5L);
  curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 20L);

and additionally on my embedded linux system I'm setting the following
sockopt:

  if (purpose == CURLSOCKTYPE_IPCXN) {
    unsigned int timeout = 20000;
    int ret = setsockopt(fd, SOL_TCP, TCP_USER_TIMEOUT, &timeout,
sizeof(timeout));
    if (ret < 0) {
      return CURL_SOCKOPT_ERROR;
    }
  }
  return CURL_SOCKOPT_OK;

are there other options out there or knobs to set? Maybe turning off Nagle?
Thanks for any suggestions!

Mark

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-05-05