mirror of
https://github.com/curl/curl.git
synced 2025-03-19 15:40:42 +08:00
cookie: Stop exporting any-domain cookies
Prior to this change any-domain cookies (cookies without a domain that are sent to any domain) were exported with domain name "unknown". Bug: https://github.com/bagder/curl/issues/292
This commit is contained in:
parent
001ab7d860
commit
3013bb6b1c
@ -96,7 +96,12 @@ main(void)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* HTTP-header style cookie */
|
/* HTTP-header style cookie. If you use the Set-Cookie format and don't
|
||||||
|
specify a domain then the cookie is sent for any domain and will not be
|
||||||
|
modified, likely not what you intended. Starting in 7.43.0 any-domain
|
||||||
|
cookies will not be exported either. For more information refer to the
|
||||||
|
CURLOPT_COOKIELIST documentation.
|
||||||
|
*/
|
||||||
snprintf(nline, sizeof(nline),
|
snprintf(nline, sizeof(nline),
|
||||||
"Set-Cookie: OLD_PREF=3d141414bf4209321; "
|
"Set-Cookie: OLD_PREF=3d141414bf4209321; "
|
||||||
"expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com");
|
"expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com");
|
||||||
|
@ -43,6 +43,9 @@ transfer to that server, likely not what you intended. Either set a domain in
|
|||||||
Set-Cookie (doing that will include sub domains) or use the Netscape format as
|
Set-Cookie (doing that will include sub domains) or use the Netscape format as
|
||||||
shown in EXAMPLE.
|
shown in EXAMPLE.
|
||||||
|
|
||||||
|
Starting in 7.43.0 the aforementioned any-domain cookies will not appear in the
|
||||||
|
lists exported by \fICURLINFO_COOKIELIST(3)\fP and \fICURLOPT_COOKIEJAR(3)\fP.
|
||||||
|
|
||||||
Additionally, there are commands available that perform actions if you pass in
|
Additionally, there are commands available that perform actions if you pass in
|
||||||
these exact strings:
|
these exact strings:
|
||||||
.IP ALL
|
.IP ALL
|
||||||
|
@ -1277,6 +1277,8 @@ static int cookie_output(struct CookieInfo *c, const char *dumphere)
|
|||||||
co = c->cookies;
|
co = c->cookies;
|
||||||
|
|
||||||
while(co) {
|
while(co) {
|
||||||
|
if(!co->domain)
|
||||||
|
continue;
|
||||||
format_ptr = get_netscape_format(co);
|
format_ptr = get_netscape_format(co);
|
||||||
if(format_ptr == NULL) {
|
if(format_ptr == NULL) {
|
||||||
fprintf(out, "#\n# Fatal libcurl error\n");
|
fprintf(out, "#\n# Fatal libcurl error\n");
|
||||||
@ -1310,7 +1312,8 @@ struct curl_slist *Curl_cookie_list(struct SessionHandle *data)
|
|||||||
c = data->cookies->cookies;
|
c = data->cookies->cookies;
|
||||||
|
|
||||||
while(c) {
|
while(c) {
|
||||||
/* fill the list with _all_ the cookies we know */
|
if(!c->domain)
|
||||||
|
continue;
|
||||||
line = get_netscape_format(c);
|
line = get_netscape_format(c);
|
||||||
if(!line) {
|
if(!line) {
|
||||||
curl_slist_free_all(list);
|
curl_slist_free_all(list);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user