You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
I think there may be a regression due to commit b1b326e.
When Curl_cookie_init is called with data set to NULL, this assignment is no longer performed:
c->running= TRUE; /* now, we're running */
If we try to add a cookie without an expiry using CURLOPT_COOKIELIST, it will be ignored in Curl_cookie_add as though it was a session cookie read from a file, due to this code:
if(!c->running&&/* read from a file */c->newsession&&/* clean session cookies */
!co->expires) { /* this is a session cookie since it doesn't expire! */freecookie(co);
returnNULL;
}
where c->running is FALSE.
I expected the following
Prior to commit b1b326e, the following program would send the cookie set with CURLOPT_COOKIELIST in the HTTP request, but not after that commit.
#include<stdio.h>#include<curl/curl.h>intmain(void)
{
curl_global_init(CURL_GLOBAL_ALL);
// Create a share object to share cookiesCURLSH*share=curl_share_init();
curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
// Create the easy handleCURL*curl=curl_easy_init();
curl_easy_setopt(curl, CURLOPT_SHARE, share);
// Set optionscurl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_URL, "http://localhost:8001/echo.cgi");
// Activate cookie enginecurl_easy_setopt(curl, CURLOPT_COOKIEFILE, "");
// Set a cookie without Max-age or Expirescurl_easy_setopt(curl, CURLOPT_COOKIELIST, "Set-Cookie: c1=v1; domain=localhost");
// Perform the HTTP requestCURLcoderes;
res=curl_easy_perform(curl);
if (res!=CURLE_OK) {
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
}
// Cleanupcurl_easy_cleanup(curl);
curl_share_cleanup(share);
curl_global_cleanup();
return0;
}
I did this
I think there may be a regression due to commit b1b326e.
When
Curl_cookie_init
is called withdata
set to NULL, this assignment is no longer performed:If we try to add a cookie without an expiry using
CURLOPT_COOKIELIST
, it will be ignored inCurl_cookie_add
as though it was a session cookie read from a file, due to this code:where
c->running
is FALSE.I expected the following
Prior to commit b1b326e, the following program would send the cookie set with
CURLOPT_COOKIELIST
in the HTTP request, but not after that commit.curl/libcurl version
curl 8.3.0-DEV (x86_64-pc-linux-gnu) libcurl/8.3.0-DEV OpenSSL/3.1.2 zlib/1.2.13 brotli/1.0.9 zstd/1.5.2 nghttp2/1.51.0 OpenLDAP/2.4.58
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL threadsafe TLS-SRP UnixSockets zstd
operating system
Linux ugla.localdomain 6.1.31_1 #1 SMP PREEMPT_DYNAMIC Wed May 31 05:53:37 UTC 2023 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: