mirror of
https://github.com/curl/curl.git
synced 2026-08-24 20:43:47 +03:00
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:
parent
f1939fa60d
commit
242a1439e7
8 changed files with 193 additions and 59 deletions
|
|
@ -76,7 +76,7 @@ LIBTESTPROGS = libauthretry libntlmconnect libprereq \
|
|||
lib2402 lib2404 lib2405 \
|
||||
lib2502 \
|
||||
lib3010 lib3025 lib3026 lib3027 \
|
||||
lib3100 lib3101 lib3102 lib3103 lib3104 lib3105 lib3207
|
||||
lib3100 lib3101 lib3102 lib3103 lib3104 lib3105 lib3207 lib3208
|
||||
|
||||
libntlmconnect_SOURCES = libntlmconnect.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
|
||||
libntlmconnect_LDADD = $(TESTUTIL_LIBS)
|
||||
|
|
@ -736,3 +736,6 @@ lib3105_SOURCES = lib3105.c $(SUPPORTFILES)
|
|||
|
||||
lib3207_SOURCES = lib3207.c $(SUPPORTFILES) $(TESTUTIL) $(THREADS) $(WARNLESS) $(MULTIBYTE)
|
||||
lib3207_LDADD = $(TESTUTIL_LIBS)
|
||||
|
||||
lib3208_SOURCES = lib3208.c $(SUPPORTFILES) $(TESTUTIL)
|
||||
lib3208_LDADD = $(TESTUTIL_LIBS)
|
||||
|
|
|
|||
100
tests/libtest/lib3208.c
Normal file
100
tests/libtest/lib3208.c
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "test.h"
|
||||
|
||||
#include "testutil.h"
|
||||
#include "warnless.h"
|
||||
#include "memdebug.h"
|
||||
|
||||
#define TEST_HANG_TIMEOUT 60 * 1000
|
||||
|
||||
CURLcode test(char *URL)
|
||||
{
|
||||
CURL *curl = NULL;
|
||||
CURLM *multi = NULL;
|
||||
int still_running;
|
||||
CURLcode i = TEST_ERR_FAILURE;
|
||||
CURLcode res = CURLE_OK;
|
||||
CURLMsg *msg;
|
||||
|
||||
start_test_timing();
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
multi_init(multi);
|
||||
|
||||
easy_init(curl);
|
||||
|
||||
easy_setopt(curl, CURLOPT_URL, URL);
|
||||
easy_setopt(curl, CURLOPT_HEADER, 1L);
|
||||
/* no peer verify */
|
||||
easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||
easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
|
||||
|
||||
/* first, make an easy perform with the handle */
|
||||
curl_easy_perform(curl);
|
||||
|
||||
/* then proceed and use it for a multi perform */
|
||||
multi_add_handle(multi, curl);
|
||||
|
||||
multi_perform(multi, &still_running);
|
||||
|
||||
abort_on_test_timeout();
|
||||
|
||||
while(still_running) {
|
||||
CURLMcode mres;
|
||||
int num;
|
||||
mres = curl_multi_wait(multi, NULL, 0, TEST_HANG_TIMEOUT, &num);
|
||||
if(mres != CURLM_OK) {
|
||||
printf("curl_multi_wait() returned %d\n", mres);
|
||||
res = TEST_ERR_MAJOR_BAD;
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
abort_on_test_timeout();
|
||||
|
||||
multi_perform(multi, &still_running);
|
||||
|
||||
abort_on_test_timeout();
|
||||
}
|
||||
|
||||
msg = curl_multi_info_read(multi, &still_running);
|
||||
if(msg)
|
||||
/* this should now contain a result code from the easy handle,
|
||||
get it */
|
||||
i = msg->data.result;
|
||||
|
||||
test_cleanup:
|
||||
|
||||
/* undocumented cleanup sequence - type UA */
|
||||
|
||||
curl_multi_cleanup(multi);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
|
||||
if(res)
|
||||
i = res;
|
||||
|
||||
return i; /* return the final return code */
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue