Buy commercial curl support. We
help you work out your issues, debug your libcurl applications, use the API,
port to new platforms, add new features and more. With a team lead by the
curl founder Daniel himself.
Re: How to properly re-use an easy handle having CURLOPT_CONNECT_ONLY=1?
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Daniel Stenberg via curl-library <curl-library_at_lists.haxx.se>
Date: Tue, 14 Jan 2025 15:01:28 +0100 (CET)
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.
Date: Tue, 14 Jan 2025 15:01:28 +0100 (CET)
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.htmlReceived on 2025-01-14