vtsl: eliminate 'data->state.ssl_scache'

Keeping the relevant 'ssl_scache' in 'data->state' leads to problems
when the owner of the cache is cleaned up and this reference is left
dangling.

Remove the ref entirely and always find the ssl_scache at the current
share or multi.

Folded in #16260 (test 3208) to verify this fixes the bug with a
dangling reference when an easy handle is used with easy_perform first
and in a multi_perform after.

Ref: #16236
Closes #16261
This commit is contained in:
Stefan Eissing 2025-02-08 12:49:34 +01:00 committed by Daniel Stenberg
parent f1939fa60d
commit 242a1439e7
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
8 changed files with 193 additions and 59 deletions

View file

@ -567,12 +567,6 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
#endif
data->state.httpreq = data->set.method;
#ifdef USE_SSL
if(!data->state.ssl_scache)
/* There was no ssl session cache set via a share, use the multi one */
data->state.ssl_scache = data->multi->ssl_scache;
#endif
data->state.requests = 0;
data->state.followlocation = 0; /* reset the location-follow counter */
data->state.this_is_a_follow = FALSE; /* reset this */