Skip to content

how to know if connections is dead? #12715

Answered by bagder
bethebest0622 asked this question in Q&A
Discussion options

You must be logged in to vote

Typically libcurl tells in the verbose output when it deems a connection needs to get closed.

If you have connections in the pool for a long time before trying to reuse them, CURLOPT_MAXLIFETIME_CONN will matter.

Some reflections on your code:

curl_easy_setopt(r, CURLOPT_ENCODING, "gzip");

  1. This uses the old option name, it s called CURLOPT_ACCEPT_ENCODING since 7.21.6
  2. We recommend setting it to "" to let libcurl pick among the ones it supports

curl_easy_setopt(r, CURLOPT_DNS_CACHE_TIMEOUT, -1);

To never timeout the DNS cache is aggressive, I hope you know what you are doing.

Replies: 2 comments 11 replies

Comment options

You must be logged in to vote
7 replies
@bagder
Comment options

@bethebest0622
Comment options

@bagder
Comment options

@bethebest0622
Comment options

@jay
Comment options

Answer selected by bagder
Comment options

You must be logged in to vote
4 replies
@jay
Comment options

@bethebest0622
Comment options

@bethebest0622
Comment options

@jay
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #12714 on January 16, 2024 12:17.