]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
ssl session cache: change cache dimensions
authorStefan Eissing <stefan@eissing.org>
Thu, 9 Jan 2025 10:18:31 +0000 (11:18 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 10 Jan 2025 09:51:26 +0000 (10:51 +0100)
Use a larger one when shared.

Closes #15953

lib/share.c
lib/transfer.c
lib/url.c
lib/urldata.h

index 8194aa864976d041324dae8086f9f6e770f3e110..4145e0c6533a37d9105593da2b08438c1ded4cd4 100644 (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
index 6fbe4487f32419e0e23094bf5ad5f85497c1c276..66756788b3e37e6817150db020b7ba62d288101d 100644 (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;
   }
index ea0298ac6aff5b568cce412558a26542f3159924..001989d186d037b4e1c57d8996ef4d50852ef331 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -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;
 
index 6cd18ad928724573326cbf6d5cd0316f82408bdb..224167f7f04b76cf89cae096b48371e1bf1001f5 100644 (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) */
 };