ssl session cache: change cache dimensions

Use a larger one when shared.

Closes #15953
This commit is contained in:
Stefan Eissing 2025-01-09 11:18:31 +01:00 committed by Daniel Stenberg
parent 423be24edb
commit 34cebd8735
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
4 changed files with 10 additions and 6 deletions

View File

@ -110,7 +110,12 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
case CURL_LOCK_DATA_SSL_SESSION:
#ifdef USE_SSL
if(!share->ssl_scache) {
if(Curl_ssl_scache_create(8, 2, &share->ssl_scache))
/* There is no way (yet) for the application to configure the
* session cache size, shared between many transfers. As for curl
* itself, a high session count will impact startup time. Also, the
* scache is not optimized for several hundreds of peers. So,
* keep it at a reasonable level. */
if(Curl_ssl_scache_create(25, 2, &share->ssl_scache))
res = CURLSHE_NOMEM;
}
#else

View File

@ -568,8 +568,10 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
#ifdef USE_SSL
if(!data->state.ssl_scache) {
result = Curl_ssl_scache_create(data->set.general_ssl.max_ssl_sessions,
2, &data->state.ssl_scache);
/* There was no ssl session cache set via a share, so we create
* one just for this transfer alone. Most transfers talk to just
* one host, but redirects may involve several occasionally. */
result = Curl_ssl_scache_create(3, 2, &data->state.ssl_scache);
if(result)
return result;
}

View File

@ -382,8 +382,6 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data)
#endif
set->dns_cache_timeout = 60; /* Timeout every 60 seconds by default */
/* Set the default size of the SSL session ID cache */
set->general_ssl.max_ssl_sessions = 5;
/* Timeout every 24 hours by default */
set->general_ssl.ca_cache_timeout = 24 * 60 * 60;

View File

@ -315,7 +315,6 @@ struct ssl_config_data {
};
struct ssl_general_config {
size_t max_ssl_sessions; /* SSL session id cache size */
int ca_cache_timeout; /* Certificate store cache timeout (seconds) */
};