diff options
author | thegeorg <thegeorg@yandex-team.com> | 2024-10-04 11:15:32 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2024-10-04 11:29:39 +0300 |
commit | 37112f646e6da1c3eb50de15cbbb8793b383b27e (patch) | |
tree | f32d6652f26110a47441c8cf8a08216eca1a52b6 /contrib/libs/curl/lib/share.c | |
parent | 9a6b8cb5c502ba2b158c337ce13e983e3c3dc78f (diff) | |
download | ydb-37112f646e6da1c3eb50de15cbbb8793b383b27e.tar.gz |
Update contrib/libs/curl to 8.10.1
commit_hash:428ef806a15515cdaa325530aa8cc6903fac5fb6
Diffstat (limited to 'contrib/libs/curl/lib/share.c')
-rw-r--r-- | contrib/libs/curl/lib/share.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/contrib/libs/curl/lib/share.c b/contrib/libs/curl/lib/share.c index c0a8d806f34..2ddaba6d7e2 100644 --- a/contrib/libs/curl/lib/share.c +++ b/contrib/libs/curl/lib/share.c @@ -26,10 +26,12 @@ #include <curl/curl.h> #include "urldata.h" +#include "connect.h" #include "share.h" #include "psl.h" #include "vtls/vtls.h" #include "hsts.h" +#include "url.h" /* The last 3 #include files should be in this order */ #include "curl_printf.h" @@ -64,7 +66,7 @@ curl_share_setopt(struct Curl_share *share, CURLSHoption option, ...) return CURLSHE_INVALID; if(share->dirty) - /* don't allow setting options while one or more handles are already + /* do not allow setting options while one or more handles are already using this share */ return CURLSHE_IN_USE; @@ -119,8 +121,12 @@ curl_share_setopt(struct Curl_share *share, CURLSHoption option, ...) break; case CURL_LOCK_DATA_CONNECT: - if(Curl_conncache_init(&share->conn_cache, 103)) - res = CURLSHE_NOMEM; + /* It is safe to set this option several times on a share. */ + if(!share->cpool.idata) { + if(Curl_cpool_init(&share->cpool, Curl_on_disconnect, + NULL, share, 103)) + res = CURLSHE_NOMEM; + } break; case CURL_LOCK_DATA_PSL: @@ -133,13 +139,13 @@ curl_share_setopt(struct Curl_share *share, CURLSHoption option, ...) res = CURLSHE_BAD_OPTION; } if(!res) - share->specifier |= (1<<type); + share->specifier |= (unsigned int)(1<<type); break; case CURLSHOPT_UNSHARE: /* this is a type this share will no longer share */ type = va_arg(param, int); - share->specifier &= ~(1<<type); + share->specifier &= ~(unsigned int)(1<<type); switch(type) { case CURL_LOCK_DATA_DNS: break; @@ -223,8 +229,9 @@ curl_share_cleanup(struct Curl_share *share) return CURLSHE_IN_USE; } - Curl_conncache_close_all_connections(&share->conn_cache); - Curl_conncache_destroy(&share->conn_cache); + if(share->specifier & (1 << CURL_LOCK_DATA_CONNECT)) { + Curl_cpool_destroy(&share->cpool); + } Curl_hash_destroy(&share->hostcache); #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES) @@ -264,11 +271,11 @@ Curl_share_lock(struct Curl_easy *data, curl_lock_data type, if(!share) return CURLSHE_INVALID; - if(share->specifier & (1<<type)) { + if(share->specifier & (unsigned int)(1<<type)) { if(share->lockfunc) /* only call this if set! */ share->lockfunc(data, type, accesstype, share->clientdata); } - /* else if we don't share this, pretend successful lock */ + /* else if we do not share this, pretend successful lock */ return CURLSHE_OK; } @@ -281,7 +288,7 @@ Curl_share_unlock(struct Curl_easy *data, curl_lock_data type) if(!share) return CURLSHE_INVALID; - if(share->specifier & (1<<type)) { + if(share->specifier & (unsigned int)(1<<type)) { if(share->unlockfunc) /* only call this if set! */ share->unlockfunc (data, type, share->clientdata); } |