feat: add CurlShare to share DNS/TLS caches across session threads - #775
Open
dokson wants to merge 1 commit into
Open
feat: add CurlShare to share DNS/TLS caches across session threads#775dokson wants to merge 1 commit into
dokson wants to merge 1 commit into
Conversation
dokson
force-pushed
the
feature/curl-share
branch
from
June 7, 2026 09:17
2553ca8 to
cc83245
Compare
dokson
force-pushed
the
feature/curl-share
branch
from
June 14, 2026 11:15
cc83245 to
a09627e
Compare
Adds a CurlShare wrapper over libcurl's share interface (curl_share_*) and a curl_share= parameter on Session and AsyncSession. Attaching a share lets the session handles reuse the DNS and TLS session caches across threads, cutting DNS lookups and TLS handshakes when reconnecting to the same host. Connection-cache sharing is opt-in (CurlShare(connect=True)) and only safe for serialized use, since libcurl does not support sharing connections between concurrent threads. The docs explain why connection pooling stays per-thread.
dokson
force-pushed
the
feature/curl-share
branch
from
June 14, 2026 11:16
a09627e to
100d4f7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
CurlShare(wrapper over libcurl'scurl_share_setopt) and acurl_share=arg onSession/AsyncSession, to share the DNS and TLS session caches across a session's thread-local handles.Per the share docs, libcurl doesn't support sharing the connection cache between concurrent threads, so it's not shared by default:
CurlShare(connect=True)opts in, for serialized use only.duphandle()doesn't inheritCURLOPT_SHARE, so it's re-attached (covers streaming/ws). Docs explain why connection pooling stays per-thread.Checklist