mirror of
https://github.com/curl/curl.git
synced 2026-07-24 21:47:18 +03:00
lib: TLS session ticket caching reworked
Described in detail in internal doc TLS-SESSIONS.md Main points: - use a new `ssl_peer_key` for cache lookups by connection filters - recognize differences between TLSv1.3 and other tickets * TLSv1.3 tickets are single-use, cache can hold several of them for a peer * TLSv1.2 are reused, keep only a single one per peer - differentiate between ticket BLOB to store (that could be persisted) and object instances - use put/take/return pattern for cache access - remember TLS version, ALPN protocol, time received and lifetime of ticket - auto-expire tickets after their lifetime Closes #15774
This commit is contained in:
parent
e5e2e09a75
commit
fa0ccd9f1f
36 changed files with 1784 additions and 780 deletions
|
|
@ -72,6 +72,7 @@
|
|||
#include "url.h"
|
||||
#include "getinfo.h"
|
||||
#include "vtls/vtls.h"
|
||||
#include "vtls/vtls_scache.h"
|
||||
#include "vquic/vquic.h"
|
||||
#include "select.h"
|
||||
#include "multiif.h"
|
||||
|
|
@ -538,7 +539,7 @@ void Curl_init_CONNECT(struct Curl_easy *data)
|
|||
*/
|
||||
CURLcode Curl_pretransfer(struct Curl_easy *data)
|
||||
{
|
||||
CURLcode result;
|
||||
CURLcode result = CURLE_OK;
|
||||
|
||||
if(!data->state.url && !data->set.uh) {
|
||||
/* we cannot do anything without URL */
|
||||
|
|
@ -577,12 +578,14 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
|
|||
data->state.httpreq = data->set.method;
|
||||
data->state.url = data->set.str[STRING_SET_URL];
|
||||
|
||||
/* Init the SSL session ID cache here. We do it here since we want to do it
|
||||
after the *_setopt() calls (that could specify the size of the cache) but
|
||||
before any transfer takes place. */
|
||||
result = Curl_ssl_initsessions(data, data->set.general_ssl.max_ssl_sessions);
|
||||
if(result)
|
||||
return result;
|
||||
#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);
|
||||
if(result)
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
data->state.requests = 0;
|
||||
data->state.followlocation = 0; /* reset the location-follow counter */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue