This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 6c338a659551c8f395954698f8e0c8607c3e3f4c Author: Niklas Haas <[email protected]> AuthorDate: Tue Jun 23 15:55:28 2026 +0200 Commit: Kacper Michajłow <[email protected]> CommitDate: Mon Jul 27 17:05:20 2026 +0000 avformat/libcurl: attach a CURLSH shared handle to all requests This allows sharing cookies, HSTS state etc. between requests inside a single AVFormatContext. This is analogous to the status quo of http.c, which also re-uses cookies across all requests. Note that the connection state, DNS cache, SSL session etc. are shared by default when using a multi handle, so we only need to explicitly share the rest. Sponsored-by: nxtedition AB Signed-off-by: Niklas Haas <[email protected]> --- libavformat/libcurl.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/libavformat/libcurl.c b/libavformat/libcurl.c index a8b8245610..6234e3c23e 100644 --- a/libavformat/libcurl.c +++ b/libavformat/libcurl.c @@ -71,6 +71,7 @@ typedef struct CurlCmd { typedef struct CurlLoop { pthread_t thread; CURLM *multi; + CURLSH *share; /* shared cookies/DNS/TLS sessions/HSTS */ pthread_mutex_t mutex; /* guards the command queue, exit and cmd->done */ pthread_cond_t cond; /* signaled when a sync command completes */ @@ -567,14 +568,20 @@ static CurlLoop *curl_loop_create(void) goto fail3; curl_multi_setopt(loop->multi, CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX); - if (pthread_create(&loop->thread, NULL, curl_worker, loop)) { - curl_multi_cleanup(loop->multi); + loop->share = curl_share_init(); + if (!loop->share) + goto fail3; + curl_share_setopt(loop->share, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE); + curl_share_setopt(loop->share, CURLSHOPT_SHARE, CURL_LOCK_DATA_HSTS); + + if (pthread_create(&loop->thread, NULL, curl_worker, loop)) goto fail3; - } return loop; fail3: + curl_multi_cleanup(loop->multi); + curl_share_cleanup(loop->share); curl_global_cleanup(); fail2: pthread_cond_destroy(&loop->cond); @@ -594,6 +601,7 @@ static void curl_loop_destroy(CurlLoop *loop) pthread_join(loop->thread, NULL); curl_multi_cleanup(loop->multi); + curl_share_cleanup(loop->share); pthread_cond_destroy(&loop->cond); pthread_mutex_destroy(&loop->mutex); av_free(loop); @@ -702,6 +710,7 @@ static void setup_curl(CurlContext *c) curl_easy_setopt(e, CURLOPT_URL, url); curl_easy_setopt(e, CURLOPT_PRIVATE, c); curl_easy_setopt(e, CURLOPT_NOSIGNAL, 1L); + curl_easy_setopt(e, CURLOPT_SHARE, c->loop->share); curl_easy_setopt(e, CURLOPT_WRITEFUNCTION, write_callback); curl_easy_setopt(e, CURLOPT_WRITEDATA, c); _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
