Re: How to properly re-use an easy handle having CURLOPT_CONNECT_ONLY=1?

Daniel Stenberg via curl-library <[email protected]>
Newsgroups gmane.comp.web.curl.library
Message-ID <[email protected]>
On Tue, 14 Jan 2025, Aleksander Mazur wrote:

> I apparently misunderstood this paragraph as a hint of how libcurl works 
> internally (that it simply won't reuse the underlying connection) rather 
> than "application MUST NOT pass such easy handle to curl_easy_perform 
> again".

Yeah, clarifying in https://github.com/curl/curl/pull/16002

Basically when you "take over" a connection like that, there is no return as 
the state of the connection cannot be safely known and understood by libcurl 
again so it is a single use that cannot be used again.

This, because there is no explicit "close" or "I'm done" function so the only 
way you can tell libcurl you are done with this connection is to call 
curl_easy_cleanup().

> So let's say I call curl_easy_cleanup + curl_easy_init before each 
> reconnection. Will libcurl reuse old TLS context and resolver cache?

Nope. Unless you make it so with a share object or using the multi interface.

-- 

  / daniel.haxx.se || https://rock-solid.curl.dev
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.