mirror of
https://github.com/curl/curl.git
synced 2026-07-24 01:47:20 +03:00
cookie: flush better
The cookie flushing (saving to a cookie jar) should only be done if a
transfer has been started. This is now done by checking the
cookies->running field, which is not reset in curl_easy_reset() so the
saving works correctly even after a call to that.
Follow-up to fd6eb8d6e7
Verified by test 1920
Reported-by: Alexander Batischev
Fixes #20090
Closes #20094
This commit is contained in:
parent
e78a466ebd
commit
18af4e4e10
5 changed files with 138 additions and 16 deletions
|
|
@ -103,7 +103,7 @@ TESTS_C = \
|
|||
lib1662.c \
|
||||
lib1900.c lib1901.c lib1902.c lib1903.c lib1905.c lib1906.c lib1907.c \
|
||||
lib1908.c lib1910.c lib1911.c lib1912.c lib1913.c \
|
||||
lib1915.c lib1916.c lib1918.c lib1919.c \
|
||||
lib1915.c lib1916.c lib1918.c lib1919.c lib1920.c \
|
||||
lib1933.c lib1934.c lib1935.c lib1936.c lib1937.c lib1938.c lib1939.c \
|
||||
lib1940.c lib1945.c \
|
||||
lib1947.c lib1948.c \
|
||||
|
|
|
|||
55
tests/libtest/lib1920.c
Normal file
55
tests/libtest/lib1920.c
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* 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 "first.h"
|
||||
|
||||
static CURLcode test_lib1920(const char *URL)
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
CURL *curl = NULL;
|
||||
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
easy_setopt(curl, CURLOPT_COOKIEFILE, libtest_arg2);
|
||||
easy_setopt(curl, CURLOPT_COOKIEJAR, libtest_arg2);
|
||||
easy_setopt(curl, CURLOPT_URL, URL);
|
||||
easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
|
||||
result = curl_easy_perform(curl);
|
||||
|
||||
if(!result) {
|
||||
/* doing a reset here should not change the cookie jar content */
|
||||
curl_easy_reset(curl);
|
||||
/* set the cookie jar name so that curl knows where to store the
|
||||
cookies after reset */
|
||||
easy_setopt(curl, CURLOPT_COOKIEJAR, libtest_arg2);
|
||||
}
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
return result;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue